下面列出了javax.swing.JScrollPane#setHorizontalScrollBarPolicy ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
public JPanel createPanel()
{
JPanel jpanel1 = new JPanel();
FormLayout formlayout1 = new FormLayout("FILL:7DLU:NONE,FILL:DEFAULT:GROW(1.0),FILL:7DLU:NONE","CENTER:3DLU:NONE,FILL:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,FILL:DEFAULT:GROW(1.0),CENTER:9DLU:NONE");
CellConstraints cc = new CellConstraints();
jpanel1.setLayout(formlayout1);
_logTextArea.setName("logTextArea");
JScrollPane jscrollpane1 = new JScrollPane();
jscrollpane1.setViewportView(_logTextArea);
jscrollpane1.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
jscrollpane1.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
jpanel1.add(jscrollpane1,cc.xy(2,6));
_logSeparator.setName("logSeparator");
_logSeparator.setText(Messages.getString("log"));
jpanel1.add(_logSeparator,cc.xy(2,4));
_tab.setName("tab");
jpanel1.add(_tab,cc.xywh(1,2,3,1));
addFillComponents(jpanel1,new int[]{ 1,2,3 },new int[]{ 1,3,4,5,6,7 });
return jpanel1;
}
private RawTextPane createTextPane(String label_name) throws Exception {
JPanel panel = new JPanel();
panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
JLabel label = new JLabel(label_name);
label.setAlignmentX(0.5f);
RawTextPane text = new RawTextPane();
text.setEditable(false);
panel.add(label);
JScrollPane scroll = new JScrollPane(text);
scroll.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
scroll.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
panel.add(scroll);
main_panel.add(panel);
return text;
}
/**
* @return the text area
*/
private JTextArea setupTextArea(JPanel contentPane) {
JPanel textAreaPanel = new JPanel(new BorderLayout());
JTextArea text = new JTextArea(NUMBER_OF_ROWS, NUMBER_OF_COLUMNS);
text.setText(this.welcomeBanner);
text.setFont(new Font("Courier New", Font.PLAIN, 12));
text.setLineWrap(true);
text.setWrapStyleWord(true);
text.setEditable(false);
text.setBackground(Color.BLUE);
text.setForeground(Color.YELLOW);
JScrollPane scrollPane = new JScrollPane(text);
scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
textAreaPanel.add(scrollPane, BorderLayout.CENTER);
contentPane.add(textAreaPanel);
return text;
}
public JPanel createdatabaseTreeView()
{
_databaseTreeView.setName("databaseTreeView");
TitledBorder titledborder1 = new TitledBorder(null,"Database Connection",TitledBorder.LEFT,TitledBorder.DEFAULT_POSITION,null,new Color(33,33,33));
_databaseTreeView.setBorder(titledborder1);
FormLayout formlayout1 = new FormLayout("FILL:DEFAULT:GROW(1.0)","FILL:DEFAULT:GROW(1.0)");
CellConstraints cc = new CellConstraints();
_databaseTreeView.setLayout(formlayout1);
_databaseTree.setName("databaseTree");
JScrollPane jscrollpane1 = new JScrollPane();
jscrollpane1.setViewportView(_databaseTree);
jscrollpane1.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
jscrollpane1.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
_databaseTreeView.add(jscrollpane1,new CellConstraints(1,1,1,1,CellConstraints.FILL,CellConstraints.FILL));
addFillComponents(_databaseTreeView,new int[0],new int[0]);
return _databaseTreeView;
}
/**
* Creates the content of the tool window panel, with {@link SarosToolbar} and the {@link
* SessionAndContactsTreeView}.
*/
public SarosMainPanelView(@NotNull Project project) throws HeadlessException {
super(new BorderLayout());
SessionAndContactsTreeView sarosTree = new SessionAndContactsTreeView(project);
SarosToolbar sarosToolbar = new SarosToolbar(project);
JScrollPane treeScrollPane = new JBScrollPane(sarosTree);
treeScrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
treeScrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
// chartPane is empty at the moment
Container chartPane = new JPanel(new BorderLayout());
JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, treeScrollPane, chartPane);
splitPane.setOneTouchExpandable(true);
splitPane.setDividerLocation(350);
// Provide minimum sizes for the two components in the split pane
Dimension minimumSize = new Dimension(300, 50);
treeScrollPane.setMinimumSize(minimumSize);
splitPane.setMinimumSize(minimumSize);
add(splitPane, BorderLayout.CENTER);
add(sarosToolbar, BorderLayout.NORTH);
}
public ChatInputPane() {
setLayout(new BorderLayout(0, 0));
JScrollPane scrollPane = new JScrollPane();
scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
add(scrollPane, BorderLayout.CENTER);
textPane = new JTextPane();
scrollPane.setViewportView(textPane);
JPanel panel_1 = new JPanel();
add(panel_1, BorderLayout.EAST);
btnSend = new JButton("Send");
panel_1.add(btnSend);
}
/**
* Configures the {@link JScrollPane} of the {@link ScrollableJPopupMenu} if set,
* namely forbids the usage of the horizontal scrollbar.
*/
private void configureScrollable() {
JPopupMenu popupMenu = getPopupMenu();
if (!(popupMenu instanceof ScrollableJPopupMenu)) {
return;
}
JScrollPane scrollPane = ((ScrollableJPopupMenu) popupMenu).getScrollPane();
scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
}
private void createLayout() {
logger.info("Creating layout. @TestResultsPanel");
this.setLayout(new GridBagLayout());
// we want the progress bar to be separate from the scroll panel
GridBagConstraints gbc = new GridBagConstraints();
gbc.gridy = 0;
gbc.gridwidth = 1;
gbc.gridheight = 1;
gbc.weightx = 1.0;
gbc.anchor = GridBagConstraints.PAGE_START;
gbc.fill = GridBagConstraints.HORIZONTAL;
addProgressBar(gbc);
final JScrollPane scrollPane1 = new JBScrollPane();
scrollPane1.setVerticalScrollBarPolicy(JBScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
scrollPane1.setHorizontalScrollBarPolicy(JBScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
gbc.gridy = 1;
gbc.weighty = 1.0;
gbc.anchor = GridBagConstraints.CENTER;
gbc.fill = GridBagConstraints.BOTH;
this.add(scrollPane1, gbc);
resultsList = new JPanel();
resultsList.setLayout(new GridBagLayout());
scrollPane1.setViewportView(resultsList);
}
private void setupGUI() {
setLayout(new GridBagLayout());
GridBagConstraints c = new GridBagConstraints();
c.insets = new Insets(5,5,5,5);
c.gridx = 0; c.gridy = 0;
c.weightx = 1; c.weighty = 1000;
c.fill = GridBagConstraints.BOTH;
txtMessage = new JTextArea();
JScrollPane scrolling = new JScrollPane(txtMessage);
add(scrolling, c);
c.gridy++;
c.weighty = 1;
c.fill = GridBagConstraints.VERTICAL;
c.anchor = GridBagConstraints.EAST;
JButton btnQuit;
add(btnQuit = new JButton("Close"),c);
// create border
//txtMessage.setBorder(BorderFactory.createEtchedBorder() );
// scrolling
scrolling.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
scrolling.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
// set font
txtMessage.setFont(new Font("Courier", Font.PLAIN, 11));
// additional flags
txtMessage.setEditable(false);
txtMessage.setLineWrap(true);
txtMessage.setWrapStyleWord(true);
// event handler
btnQuit.addActionListener(this);
}
/**
* Create a new instance of BiographyInfoPane.
*/
public BiographyInfoPane()
{
this.itemsPanel = new JPanel();
setLayout(new GridBagLayout());
Box vbox = Box.createVerticalBox();
itemsPanel.setLayout(new GridBagLayout());
itemsPanel.setBorder(new EmptyBorder(8, 5, 8, 5));
vbox.add(Box.createVerticalStrut(10));
detailsScroll = new JScrollPane(itemsPanel);
detailsScroll.setPreferredSize(detailsScroll.getMaximumSize());
detailsScroll.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
detailsScroll.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
detailsScroll.setMinimumSize(new Dimension(600, 0));
vbox.add(detailsScroll);
vbox.add(Box.createVerticalStrut(10));
Box hbox = Box.createHorizontalBox();
hbox.add(Box.createHorizontalGlue());
JButton addCustomItemButton = new JButton();
hbox.add(addCustomItemButton);
hbox.add(Box.createHorizontalGlue());
vbox.add(hbox);
vbox.add(Box.createVerticalGlue());
GridBagConstraints gbc = new GridBagConstraints();
gbc.anchor = GridBagConstraints.NORTHWEST;
gbc.weightx = 1;
gbc.fill = GridBagConstraints.VERTICAL;
gbc.weighty = 1;
gbc.insets = new Insets(5, 5, 5, 5);
add(vbox, gbc);
}
public UserActionPanel(final SwingGameController controller) {
this.controller=controller;
setMinimumSize(new Dimension(0, 114));
setOpaque(false);
final JLabel emptyLabel=new JLabel("");
imageLabel.setHorizontalAlignment(SwingConstants.CENTER);
busyItem = new ImageThrobber.Builder(BUSY_IMAGE)
.antiAlias(true)
.spinPeriod(3000)
.build();
actionButton=new JButton();
actionButton.setIcon(MagicImages.getIcon(MagicIcon.FORWARD));
actionButton.setFocusable(false);
actionButton.addActionListener(this);
actionButton.addMouseListener(new MouseAdapter() {
@Override
public void mouseReleased(MouseEvent e) {
if (SwingUtilities.isRightMouseButton(e)) {
controller.passKeyPressed();
}
}
});
undoButton=new JButton(MagicImages.getIcon(MagicIcon.UNDO));
undoButton.setMargin(new Insets(1,1,1,1));
undoButton.setIconTextGap(2);
undoButton.setEnabled(false);
undoButton.setFocusable(false);
undoButton.addActionListener(this);
actionPanel=new JPanel();
actionCardLayout=new CardLayout();
actionPanel.setLayout(actionCardLayout);
actionPanel.setOpaque(false);
actionPanel.add(emptyLabel,"0");
actionPanel.add(imageLabel, "4");
actionPanel.add(busyItem,"1");
actionPanel.add(actionButton,"2");
final JPanel rightPanel=new JPanel(new GridLayout(2,1,0,2));
rightPanel.setPreferredSize(new Dimension(60,0));
rightPanel.add(actionPanel);
rightPanel.add(undoButton);
rightPanel.setOpaque(false);
contentPanel=new JPanel();
contentPanel.setLayout(new BorderLayout());
contentPanel.setOpaque(false);
final JScrollPane scroller = new JScrollPane();
scroller.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
scroller.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
scroller.getViewport().setOpaque(false);
scroller.getViewport().add(contentPanel);
setLayout(new BorderLayout());
add(scroller, BorderLayout.CENTER);
add(rightPanel,BorderLayout.EAST);
disableButton(false);
// add mouse over listeners used to display the card image
// associated with the current choice if applicable.
setCardPopupOnMouseOverListener();
setComponentOnMouseOverListener(scroller);
setComponentOnMouseOverListener(rightPanel);
setComponentOnMouseOverListener(actionButton);
setComponentOnMouseOverListener(undoButton);
}
static JPopupMenu createPopup() {
NotificationDisplayerImpl displayer = NotificationDisplayerImpl.getInstance();
List<NotificationImpl> notifications = displayer.getNotifications();
if( notifications.isEmpty() )
return null;
JPopupMenu res = new JPopupMenu();
Dimension prefSize = new Dimension();
int avgRowHeight = 0;
int rowCount = 0;
final JPanel panel = new JPanel( new GridBagLayout());
final JScrollPane scroll = new JScrollPane(panel);
panel.setOpaque(true);
Color panelBackground = UIManager.getColor("nb.core.ui.popupList.background"); //NOI18N
if( null == panelBackground )
panelBackground = UIManager.getColor("Tree.background"); //NOI18N
panel.setBackground( panelBackground );
for( NotificationImpl n : notifications ) {
final JPanel row = new JPanel(new GridBagLayout());
row.setOpaque(false);
JComponent component = n.getPopupComponent();
if( null == component ) {
continue; //just in case...
}
row.add(component, new GridBagConstraints(0, 0, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(2,2,2,2), 1, 1));
JButton btnDismiss = new BalloonManager.DismissButton();
final NotificationImpl notification = n;
btnDismiss.addActionListener( new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
notification.clear();
panel.remove(row);
panel.getParent().invalidate();
panel.getParent().repaint();
panel.getParent().getParent().invalidate();
panel.getParent().getParent().repaint();
if( panel.getComponentCount() == 1 )
PopupList.dismiss();
}
});
row.add(btnDismiss, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHEAST, GridBagConstraints.NONE, new Insets(5,3,3,3), 1, 1));
panel.add(row, new GridBagConstraints(0, rowCount, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0,0,0,0), 1, 1));
Dimension size = row.getPreferredSize();
if( size.width > prefSize.width )
prefSize.width = size.width;
if( rowCount++ < MAX_VISIBLE_ROWS )
prefSize.height += size.height;
avgRowHeight += size.height;
}
panel.add(new JLabel(), new GridBagConstraints(0, rowCount, 1, 1, 0.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0,0,0,0), 1, 1));
avgRowHeight /= notifications.size();
scroll.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
scroll.setBorder(BorderFactory.createEmptyBorder());
scroll.getVerticalScrollBar().setUnitIncrement(avgRowHeight);
scroll.getVerticalScrollBar().setBlockIncrement(MAX_VISIBLE_ROWS*avgRowHeight);
int scrollBarWidth = scroll.getVerticalScrollBar().getPreferredSize().width;
if( scrollBarWidth <= 0 )
scrollBarWidth = UIManager.getInt("ScrollBar.width"); //NOI18N
if( scrollBarWidth <= 0 )
scrollBarWidth = 18; //let's take some reasonable guess
prefSize.width += scrollBarWidth;
Insets i = scroll.getInsets();
if( null != i ) {
prefSize.width += i.left + i.right;
prefSize.height += i.top + i.bottom;
}
if( rowCount <= MAX_VISIBLE_ROWS )
prefSize = panel.getPreferredSize();
prefSize.height = Math.min( prefSize.height, 600 );
if( prefSize.width > 800 ) {
prefSize.width = 800;
scroll.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
}
scroll.getViewport().setPreferredSize(prefSize);
scroll.getViewport().setMinimumSize(prefSize);
res.add( scroll );
return res;
}
private void createMetaDataPanel() {
// Main panel which holds all the components in a grid
pnMetaData = new GridBagPanel();
scrollMeta = new JScrollPane(pnMetaData);
scrollMeta.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
scrollMeta.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
pnSideMenu.add(scrollMeta, BorderLayout.CENTER);
int rowCounter = 0;
int vertWeightSum = 0;
// Create labels and components for each parameter
for (Parameter p : paramMeta.getParameters()) {
if (!(p instanceof UserParameter))
continue;
UserParameter up = (UserParameter) p;
Node comp = up.createEditingComponent();
// comp.setToolTipText(up.getDescription());
// Set the initial value
Object value = up.getValue();
if (value != null)
up.setValueToComponent(comp, value);
// By calling this we make sure the components will never be resized
// smaller than their optimal size
// comp.setMinimumSize(comp.getPreferredSize());
JLabel label = new JLabel(p.getName());
pnMetaData.add(label, 0, rowCounter);
// label.setLabelFor(comp);
parametersAndComponents.put(p.getName(), comp);
JComboBox t = new JComboBox();
// int comboh = t.getPreferredSize().height;
// int comph = comp.getPreferredSize().height;
// Multiple selection will be expandable, other components not
// int verticalWeight = comph > 2 * comboh ? 1 : 0;
// vertWeightSum += verticalWeight;
// pnMetaData.add(comp, 1, rowCounter, 1, 1, 1, verticalWeight, GridBagConstraints.VERTICAL);
rowCounter++;
}
}
public MultiSpectraVisualizerWindow(PeakListRow row, RawDataFile raw) {
setBackground(Color.WHITE);
setExtendedState(JFrame.MAXIMIZED_BOTH);
setMinimumSize(new Dimension(800, 600));
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
getContentPane().setLayout(new BorderLayout());
pnGrid = new JPanel();
// any number of rows
pnGrid.setLayout(new GridLayout(0, 1, 0, 25));
pnGrid.setAutoscrolls(true);
JScrollPane scrollPane = new JScrollPane(pnGrid);
scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
getContentPane().add(scrollPane, BorderLayout.CENTER);
JPanel pnMenu = new JPanel();
FlowLayout fl_pnMenu = (FlowLayout) pnMenu.getLayout();
fl_pnMenu.setVgap(0);
fl_pnMenu.setAlignment(FlowLayout.LEFT);
getContentPane().add(pnMenu, BorderLayout.NORTH);
JButton nextRaw = new JButton("next");
nextRaw.addActionListener(e -> nextRaw());
JButton prevRaw = new JButton("prev");
prevRaw.addActionListener(e -> prevRaw());
pnMenu.add(prevRaw);
pnMenu.add(nextRaw);
lbRaw = new JLabel();
pnMenu.add(lbRaw);
JLabel lbRawTotalWithFragmentation = new JLabel();
pnMenu.add(lbRaw);
int n = 0;
for (Feature f : row.getPeaks()) {
if (f.getMostIntenseFragmentScanNumber() > 0)
n++;
}
lbRawTotalWithFragmentation.setText("(total raw:" + n + ")");
// add charts
setData(row, raw);
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
setVisible(true);
validate();
repaint();
pack();
}
public ChatPanel() {
super(new BorderLayout());
JPanel addressPanel = new JPanel(new BorderLayout());
addressPanel.setBorder(BorderFactory.createTitledBorder("Your contacts"));
addressList = new JList<>();
addressList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
addressList.setPreferredSize(new Dimension(300, 300));
addressPanel.add(addressList, BorderLayout.CENTER);
add(addressPanel, BorderLayout.LINE_START);
addressList.addListSelectionListener(this);
pinField = new JPasswordField(12);
pinField.addActionListener(this);
JPanel panelSendMessage = new JPanel(new BorderLayout());
inputField = new JTextField();
inputField.setToolTipText("Enter your message");
panelSendMessage.add(new Desc("Enter your message", inputField), BorderLayout.CENTER);
inputField.addActionListener(this);
inputField.setEnabled(false);
btnSend = new JButton("");
Icon sendIcon = IconFontSwing.buildIcon(FontAwesome.PAPER_PLANE_O, 24, btnSend.getForeground());
btnSend.setIcon(sendIcon);
btnSend.setToolTipText("Send your message");
btnSend.addActionListener(this);
btnSend.setEnabled(false);
panelSendMessage.add(new Desc(" ", btnSend), BorderLayout.EAST);
displayField = new JTextPane();
displayField.setContentType("text/html");
displayField.setEditable(false);
displayField.setText(HTML_FORMAT);
scrollPane = new JScrollPane(displayField);
scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
JPanel panelCenter = new JPanel(new BorderLayout());
panelCenter.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));
add(panelCenter, BorderLayout.CENTER);
panelCenter.add(scrollPane, BorderLayout.CENTER);
panelCenter.add(panelSendMessage, BorderLayout.SOUTH);
setSize(280, 400);
}
public JPanel createPanel()
{
JPanel jpanel1 = new JPanel();
FormLayout formlayout1 = new FormLayout("FILL:7DLU:NONE,RIGHT:MAX(65DLU;DEFAULT):NONE,FILL:3DLU:NONE,FILL:60DLU:NONE,FILL:3DLU:NONE,FILL:DEFAULT:NONE,FILL:7DLU:NONE,FILL:60DLU:NONE,FILL:3DLU:NONE,FILL:DEFAULT:GROW(1.0),FILL:7DLU:NONE","CENTER:9DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,FILL:50DLU:GROW(1.0),CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:9DLU:NONE");
CellConstraints cc = new CellConstraints();
jpanel1.setLayout(formlayout1);
_jrePathLabel.setName("jrePathLabel");
_jrePathLabel.setText(Messages.getString("jrePath"));
jpanel1.add(_jrePathLabel,cc.xy(2,2));
_jreMinLabel.setName("jreMinLabel");
_jreMinLabel.setText(Messages.getString("jreMin"));
jpanel1.add(_jreMinLabel,cc.xy(2,4));
_jreMaxLabel.setName("jreMaxLabel");
_jreMaxLabel.setText(Messages.getString("jreMax"));
jpanel1.add(_jreMaxLabel,cc.xy(2,6));
_jvmOptionsTextLabel.setName("jvmOptionsTextLabel");
_jvmOptionsTextLabel.setText(Messages.getString("jvmOptions"));
jpanel1.add(_jvmOptionsTextLabel,new CellConstraints(2,12,1,1,CellConstraints.DEFAULT,CellConstraints.TOP));
_jrePathField.setName("jrePathField");
_jrePathField.setToolTipText(Messages.getString("jrePathTip"));
jpanel1.add(_jrePathField,cc.xywh(4,2,7,1));
_jreMinField.setName("jreMinField");
jpanel1.add(_jreMinField,cc.xy(4,4));
_jreMaxField.setName("jreMaxField");
jpanel1.add(_jreMaxField,cc.xy(4,6));
_jvmOptionsTextArea.setName("jvmOptionsTextArea");
_jvmOptionsTextArea.setToolTipText(Messages.getString("jvmOptionsTip"));
JScrollPane jscrollpane1 = new JScrollPane();
jscrollpane1.setViewportView(_jvmOptionsTextArea);
jscrollpane1.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
jscrollpane1.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
jpanel1.add(jscrollpane1,cc.xywh(4,12,7,1));
_initialHeapSizeLabel.setName("initialHeapSizeLabel");
_initialHeapSizeLabel.setText(Messages.getString("initialHeapSize"));
jpanel1.add(_initialHeapSizeLabel,cc.xy(2,8));
_maxHeapSizeLabel.setName("maxHeapSizeLabel");
_maxHeapSizeLabel.setText(Messages.getString("maxHeapSize"));
jpanel1.add(_maxHeapSizeLabel,cc.xy(2,10));
JLabel jlabel1 = new JLabel();
jlabel1.setText("MB");
jpanel1.add(jlabel1,cc.xy(6,8));
JLabel jlabel2 = new JLabel();
jlabel2.setText("MB");
jpanel1.add(jlabel2,cc.xy(6,10));
_initialHeapSizeField.setName("initialHeapSizeField");
jpanel1.add(_initialHeapSizeField,cc.xy(4,8));
_maxHeapSizeField.setName("maxHeapSizeField");
jpanel1.add(_maxHeapSizeField,cc.xy(4,10));
jpanel1.add(createPanel1(),cc.xywh(2,14,9,1));
_maxHeapPercentField.setName("maxHeapPercentField");
jpanel1.add(_maxHeapPercentField,cc.xy(8,10));
_initialHeapPercentField.setName("initialHeapPercentField");
jpanel1.add(_initialHeapPercentField,cc.xy(8,8));
_jdkPreferenceCombo.setName("jdkPreferenceCombo");
jpanel1.add(_jdkPreferenceCombo,cc.xywh(8,4,3,1));
JLabel jlabel3 = new JLabel();
jlabel3.setText(Messages.getString("freeMemory"));
jpanel1.add(jlabel3,cc.xy(10,8));
JLabel jlabel4 = new JLabel();
jlabel4.setText(Messages.getString("freeMemory"));
jpanel1.add(jlabel4,cc.xy(10,10));
addFillComponents(jpanel1,new int[]{ 1,2,3,4,5,6,7,8,9,10,11 },new int[]{ 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 });
return jpanel1;
}
private void settingsDetailsButtonActionPerformed() {
final JDialog dialog = new JDialog(this, "Pro AI - Settings Details");
String message = "";
if (tabPaneMain.getSelectedIndex() == 0) { // Debugging
message =
"Debugging\r\n"
+ "\r\n"
+ "AI Logging: When this is checked, the AI's will output their logs, as they come "
+ "in, so you can see exactly what the AI is thinking.\r\n"
+ "Note that if you check this on, you still have to press OK then reopen the "
+ "settings window for the logs to actually start displaying.\r\n"
+ "\r\n"
+ "Log Depth: This setting lets you choose how deep you want the AI logging to be. "
+ "Fine only displays the high-level events, like the start of a phase, etc.\r\n"
+ "Finer displays medium-level events, such as attacks, reinforcements, etc.\r\n"
+ "Finest displays all the AI logging available. Can be used for detailed analysis, "
+ "but is a lot harder to read through it.\r\n"
+ "\r\n"
+ "Pause AI's: This checkbox pauses all the AI's while it's checked, so you can look "
+ "at the logs without the AI's outputting floods of information.\r\n"
+ "\r\n"
+ "Limit Log History To X Rounds: If this is checked, the AI log information will "
+ "be limited to X rounds of information.\r\n";
}
final JTextArea label = new JTextArea(message);
label.setFont(new Font("Segoe UI", Font.PLAIN, 12));
label.setEditable(false);
label.setAutoscrolls(true);
label.setLineWrap(false);
label.setFocusable(false);
label.setWrapStyleWord(true);
label.setLocation(0, 0);
dialog.setBackground(label.getBackground());
dialog.setLayout(new BorderLayout());
final JScrollPane pane = new JScrollPane();
pane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
pane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
pane.setViewportView(label);
dialog.add(pane, BorderLayout.CENTER);
final JButton button = new JButton("Close");
button.setMinimumSize(new Dimension(100, 30));
button.addActionListener(e -> dialog.dispose());
dialog.add(button, BorderLayout.SOUTH);
dialog.setMinimumSize(new Dimension(500, 300));
dialog.setSize(new Dimension(800, 600));
dialog.setResizable(true);
dialog.setLocationRelativeTo(this);
dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
dialog.setVisible(true);
}
public JPanel createPanel()
{
JPanel jpanel1 = new JPanel();
FormLayout formlayout1 = new FormLayout("FILL:7DLU:NONE,RIGHT:MAX(65DLU;DEFAULT):NONE,FILL:3DLU:NONE,FILL:DEFAULT:NONE,FILL:7DLU:NONE,FILL:DEFAULT:NONE,FILL:7DLU:NONE,FILL:DEFAULT:NONE,FILL:7DLU:NONE,FILL:DEFAULT:NONE,FILL:DEFAULT:GROW(1.0),FILL:7DLU:NONE","CENTER:9DLU:NONE,CENTER:DEFAULT:NONE,CENTER:9DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,FILL:DEFAULT:GROW(0.2),CENTER:3DLU:NONE,FILL:DEFAULT:GROW(1.0),CENTER:9DLU:NONE");
CellConstraints cc = new CellConstraints();
jpanel1.setLayout(formlayout1);
_headerTypeLabel.setName("headerTypeLabel");
_headerTypeLabel.setText(Messages.getString("headerType"));
jpanel1.add(_headerTypeLabel,cc.xy(2,2));
_guiHeaderRadio.setActionCommand("GUI");
_guiHeaderRadio.setName("guiHeaderRadio");
_guiHeaderRadio.setText(Messages.getString("gui"));
_guiHeaderRadio.setToolTipText(Messages.getString("guiTooltip"));
_headerButtonGroup.add(_guiHeaderRadio);
jpanel1.add(_guiHeaderRadio,cc.xy(4,2));
_consoleHeaderRadio.setActionCommand("Console");
_consoleHeaderRadio.setName("consoleHeaderRadio");
_consoleHeaderRadio.setText(Messages.getString("console"));
_consoleHeaderRadio.setToolTipText(Messages.getString("consoleTooltip"));
_headerButtonGroup.add(_consoleHeaderRadio);
jpanel1.add(_consoleHeaderRadio,cc.xy(6,2));
_headerObjectsTextArea.setName("headerObjectsTextArea");
JScrollPane jscrollpane1 = new JScrollPane();
jscrollpane1.setViewportView(_headerObjectsTextArea);
jscrollpane1.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
jscrollpane1.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
jpanel1.add(jscrollpane1,cc.xywh(4,6,8,1));
_libsTextArea.setName("libsTextArea");
JScrollPane jscrollpane2 = new JScrollPane();
jscrollpane2.setViewportView(_libsTextArea);
jscrollpane2.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
jscrollpane2.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
jpanel1.add(jscrollpane2,cc.xywh(4,8,8,1));
_headerObjectsCheck.setActionCommand("Object files");
_headerObjectsCheck.setName("headerObjectsCheck");
_headerObjectsCheck.setText(Messages.getString("objectFiles"));
jpanel1.add(_headerObjectsCheck,new CellConstraints(2,6,1,1,CellConstraints.DEFAULT,CellConstraints.TOP));
_libsCheck.setActionCommand("w32api");
_libsCheck.setName("libsCheck");
_libsCheck.setText(Messages.getString("libs"));
jpanel1.add(_libsCheck,new CellConstraints(2,8,1,1,CellConstraints.DEFAULT,CellConstraints.TOP));
_linkerOptionsSeparator.setName("linkerOptionsSeparator");
_linkerOptionsSeparator.setText(Messages.getString("linkerOptions"));
jpanel1.add(_linkerOptionsSeparator,cc.xywh(2,4,10,1));
_jniGuiHeaderRadio.setActionCommand(Messages.getString("jniGui"));
_jniGuiHeaderRadio.setForeground(new Color(255,102,0));
_jniGuiHeaderRadio.setName("jniGuiHeaderRadio");
_jniGuiHeaderRadio.setText(Messages.getString("jniGui"));
_jniGuiHeaderRadio.setToolTipText(Messages.getString("jniGuiTooltip"));
_headerButtonGroup.add(_jniGuiHeaderRadio);
jpanel1.add(_jniGuiHeaderRadio,cc.xy(8,2));
_jniConsoleHeaderRadio.setActionCommand(Messages.getString("jniConsole"));
_jniConsoleHeaderRadio.setForeground(new Color(255,102,0));
_jniConsoleHeaderRadio.setName("jniConsoleHeaderRadio");
_jniConsoleHeaderRadio.setText(Messages.getString("jniConsole"));
_jniConsoleHeaderRadio.setToolTipText(Messages.getString("jniConsoleTooltip"));
_headerButtonGroup.add(_jniConsoleHeaderRadio);
jpanel1.add(_jniConsoleHeaderRadio,cc.xy(10,2));
addFillComponents(jpanel1,new int[]{ 1,2,3,4,5,6,7,8,9,10,11,12 },new int[]{ 1,2,3,4,5,6,7,8,9 });
return jpanel1;
}
private JScrollPane createScrollPane(JTextArea textArea) {
JScrollPane result = new JScrollPane(textArea);
result.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
return result;
}
@Override
protected JPanel assemble() {
peers = new Vector<TransferPeerBuilder>();
GridBagConstraints spacerConstraints = new GridBagConstraints();
spacerConstraints.gridx = GridBagConstraints.REMAINDER;
spacerConstraints.gridy = GridBagConstraints.RELATIVE;
spacerConstraints.weightx = 1;
spacerConstraints.weighty = 1;
spacerConstraints.fill = GridBagConstraints.BOTH;
list = new JPanel();
list.setLayout(new GridBagLayout());
contentConstraints = new GridBagConstraints();
contentConstraints.gridx = GridBagConstraints.REMAINDER;
contentConstraints.gridy = GridBagConstraints.RELATIVE;
contentConstraints.fill = GridBagConstraints.HORIZONTAL;
contentConstraints.anchor = GridBagConstraints.NORTH;
contentConstraints.insets.bottom = 3;
ActionLocalizer al = Messages.getLocalizer();
trim = new JButton(al.localize("trimdownloads"));
trim.addActionListener(this);
list.add(new JPanel(), spacerConstraints);
JPanel cont = new JPanel();
cont.setLayout(new GridBagLayout());
GridBagConstraints contgbc = new GridBagConstraints();
if (!globals.get(Traits.class).isAvailable("4.0.x")) {
JTextArea txt = new JTextArea(Messages.getString(ID + ".booster.plug"));
txt.setLineWrap(true);
txt.setWrapStyleWord(true);
txt.setPreferredSize(new Dimension(ITEMWIDTH + 2 * 10,50));
txt.setEditable(false);
txt.setBackground(null);
txt.setForeground(Color.RED);
cont.add(txt,contgbc);
contgbc.gridx=0;
contgbc.gridy =1;
contgbc.insets = new Insets(5,5,5,5);
contgbc.anchor=GridBagConstraints.NORTHEAST;
order=new JButton(Messages.getString(ID + ".booster.ok"));
order.addActionListener(this);
cont.add(order,contgbc);
contgbc.gridy=2;
contgbc.gridx=0;
}
JScrollPane tmp = new JScrollPane(list);
tmp.setBorder(BorderFactory.createEmptyBorder());
tmp.getVerticalScrollBar().setUnitIncrement(20);
tmp.setPreferredSize(new Dimension(ITEMWIDTH + 2 * 10, 400));
tmp.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
contgbc.weightx=1;
contgbc.weighty=1;
cont.add(tmp,contgbc);
JPanel ret = new DialogBuilder(cont)
.withTitle(Messages.getString(ID + ".title"))
.withSubTitle(Messages.getString(ID + ".subtitle"))
.withButtons(new ButtonBarBuilder().add(trim)).build(globals);
globals.get(TransferManager.class).setPeer(this);
return ret;
}