下面列出了javax.swing.JLabel#setMinimumSize ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
private static void init(Container container) {
container.setLayout(new GridBagLayout());
GridBagConstraints gbc = new GridBagConstraints();
gbc.fill = GridBagConstraints.BOTH;
gbc.gridx = 0;
gbc.gridy = 1;
JLabel label = new JLabel();
Dimension size = new Dimension(111, 0);
label.setPreferredSize(size);
label.setMinimumSize(size);
container.add(label, gbc);
gbc.gridx = 1;
gbc.weightx = 1;
container.add(new JScrollBar(JScrollBar.HORIZONTAL, 1, 111, 1, 1111), gbc);
gbc.gridx = 2;
gbc.gridy = 0;
gbc.weightx = 0;
gbc.weighty = 1;
container.add(new JScrollBar(JScrollBar.VERTICAL, 1, 111, 1, 1111), gbc);
}
private static void init(Container container) {
container.setLayout(new GridBagLayout());
GridBagConstraints gbc = new GridBagConstraints();
gbc.fill = GridBagConstraints.BOTH;
gbc.gridx = 0;
gbc.gridy = 1;
JLabel label = new JLabel();
Dimension size = new Dimension(111, 0);
label.setPreferredSize(size);
label.setMinimumSize(size);
container.add(label, gbc);
gbc.gridx = 1;
gbc.weightx = 1;
container.add(new JScrollBar(JScrollBar.HORIZONTAL, 1, 111, 1, 1111), gbc);
gbc.gridx = 2;
gbc.gridy = 0;
gbc.weightx = 0;
gbc.weighty = 1;
container.add(new JScrollBar(JScrollBar.VERTICAL, 1, 111, 1, 1111), gbc);
}
private static void init(Container container) {
container.setLayout(new GridBagLayout());
GridBagConstraints gbc = new GridBagConstraints();
gbc.fill = GridBagConstraints.BOTH;
gbc.gridx = 0;
gbc.gridy = 1;
JLabel label = new JLabel();
Dimension size = new Dimension(111, 0);
label.setPreferredSize(size);
label.setMinimumSize(size);
container.add(label, gbc);
gbc.gridx = 1;
gbc.weightx = 1;
container.add(new JScrollBar(JScrollBar.HORIZONTAL, 1, 111, 1, 1111), gbc);
gbc.gridx = 2;
gbc.gridy = 0;
gbc.weightx = 0;
gbc.weighty = 1;
container.add(new JScrollBar(JScrollBar.VERTICAL, 1, 111, 1, 1111), gbc);
}
private static void init(Container container) {
container.setLayout(new GridBagLayout());
GridBagConstraints gbc = new GridBagConstraints();
gbc.fill = GridBagConstraints.BOTH;
gbc.gridx = 0;
gbc.gridy = 1;
JLabel label = new JLabel();
Dimension size = new Dimension(111, 0);
label.setPreferredSize(size);
label.setMinimumSize(size);
container.add(label, gbc);
gbc.gridx = 1;
gbc.weightx = 1;
container.add(new JScrollBar(JScrollBar.HORIZONTAL, 1, 111, 1, 1111), gbc);
gbc.gridx = 2;
gbc.gridy = 0;
gbc.weightx = 0;
gbc.weighty = 1;
container.add(new JScrollBar(JScrollBar.VERTICAL, 1, 111, 1, 1111), gbc);
}
private static void init(Container container) {
container.setLayout(new GridBagLayout());
GridBagConstraints gbc = new GridBagConstraints();
gbc.fill = GridBagConstraints.BOTH;
gbc.gridx = 0;
gbc.gridy = 1;
JLabel label = new JLabel();
Dimension size = new Dimension(111, 0);
label.setPreferredSize(size);
label.setMinimumSize(size);
container.add(label, gbc);
gbc.gridx = 1;
gbc.weightx = 1;
container.add(new JScrollBar(JScrollBar.HORIZONTAL, 1, 111, 1, 1111), gbc);
gbc.gridx = 2;
gbc.gridy = 0;
gbc.weightx = 0;
gbc.weighty = 1;
container.add(new JScrollBar(JScrollBar.VERTICAL, 1, 111, 1, 1111), gbc);
}
private static void init(Container container) {
container.setLayout(new GridBagLayout());
GridBagConstraints gbc = new GridBagConstraints();
gbc.fill = GridBagConstraints.BOTH;
gbc.gridx = 0;
gbc.gridy = 1;
JLabel label = new JLabel();
Dimension size = new Dimension(111, 0);
label.setPreferredSize(size);
label.setMinimumSize(size);
container.add(label, gbc);
gbc.gridx = 1;
gbc.weightx = 1;
container.add(new JScrollBar(JScrollBar.HORIZONTAL, 1, 111, 1, 1111), gbc);
gbc.gridx = 2;
gbc.gridy = 0;
gbc.weightx = 0;
gbc.weighty = 1;
container.add(new JScrollBar(JScrollBar.VERTICAL, 1, 111, 1, 1111), gbc);
}
private void add(JPanel jPanel, Color color) {
if (color == null) {
JLabel jLabel = new JLabel();
Dimension dimension = new Dimension(ColorIcon.SIZE, ColorIcon.SIZE);
jLabel.setMinimumSize(dimension);
jLabel.setPreferredSize(dimension);
jLabel.setMaximumSize(dimension);
jPanel.add(jLabel);
return;
}
ColorIcon icon = new ColorIcon(color);
icons.add(icon);
JButton jButton = createButton(icon);
jButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
save(color);
}
});
jPanel.add(jButton);
}
public StatusBar() {
setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
setBorder(new EtchedBorder());
statusTextPanel = new JPanel();
statusTextPanel.setLayout(new BoxLayout(statusTextPanel, BoxLayout.X_AXIS));
statusTextPanel.setBorder(new EtchedBorder(EtchedBorder.RAISED));
statusTextLabel = new JLabel();
statusTextLabel.setFont(statusBarFont);
statusTextLabel.setMinimumSize(new Dimension(100, STATUS_BAR_HEIGHT));
statusTextLabel.setPreferredSize(new Dimension(3200, STATUS_BAR_HEIGHT));
statusTextPanel.add(Box.createRigidArea(new Dimension(5, STATUS_BAR_HEIGHT)));
statusTextPanel.add(statusTextLabel);
add(statusTextPanel);
memoryLabel = new LabeledProgressBar();
memoryPanel = new JPanel();
memoryPanel.setLayout(new BoxLayout(memoryPanel, BoxLayout.X_AXIS));
memoryPanel.setBorder(new EtchedBorder(EtchedBorder.RAISED));
memoryPanel.add(Box.createRigidArea(new Dimension(10, STATUS_BAR_HEIGHT)));
memoryPanel.add(memoryLabel);
memoryPanel.add(Box.createRigidArea(new Dimension(10, STATUS_BAR_HEIGHT)));
memoryLabel.addMouseListener(this);
add(memoryPanel);
Thread memoryLabelUpdaterThread = new Thread(this, "Memory label updater thread");
memoryLabelUpdaterThread.start();
}
/**
* Create a label for the path input.
*
* @return created label.
*/
private JLabel createPathLabel() {
JLabel label = new JLabel();
label.setText( Messages.getString( "DrillDownDialog.PathInput.Label" ) );
label.setMinimumSize( new Dimension( 0, 20 ) );
return label;
}
/**
* Create a label of the "server URL" text field.
*
* @return created label.
*/
private JLabel createServerUrlLabel() {
JLabel label = new JLabel();
label.setText( Messages.getString( "DrillDownDialog.ServerUrlInput.Label" ) );
label.setMinimumSize( new Dimension( 0, 20 ) );
return label;
}
/**
* Initializes Property Summary section.
*
* @return Property Summary panel.
*/
private JPanel initPropertyPane() {
propertyPane = new PropertyPaneView();
String valueTitle = NbBundle.getMessage(CSSStylesSelectionPanel.class, "CSSStylesSelectionPanel.value"); // NOI18N
propertyPane.setProperties(new Node.Property[] {
new PropertySupport.ReadOnly<String>(MatchedPropertyNode.PROPERTY_VALUE, String.class, valueTitle, null) {
@Override
public String getValue() throws IllegalAccessException, InvocationTargetException {
return null;
}
}
});
ExplorerManagerProviderPanel propertyPanePanel = new ExplorerManagerProviderPanel();
propertyPanePanel.setLayout(new BorderLayout());
propertyPanePanel.add(propertyPane, BorderLayout.CENTER);
JPanel headerPanel = new JPanel();
headerPanel.setLayout(new BorderLayout());
JPanel titlePanel = new JPanel();
titlePanel.setLayout(new BoxLayout(titlePanel, BoxLayout.X_AXIS));
propertySummaryLabel = new JLabel();
propertySummaryLabel.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 0));
propertySummaryLabel.setMinimumSize(new Dimension(0,0));
titlePanel.add(propertySummaryLabel);
titlePanel.add(Box.createHorizontalGlue());
JToggleButton pseudoClassToggle = new JToggleButton();
pseudoClassToggle.setFocusPainted(false);
pseudoClassToggle.setIcon(ImageUtilities.loadImageIcon("org/netbeans/modules/web/inspect/resources/elementStates.png", true)); // NOI18N
pseudoClassToggle.setToolTipText(NbBundle.getMessage(CSSStylesSelectionPanel.class, "CSSStylesSelectionPanel.pseudoClasses")); // NOI18N
CustomToolbar toolBar = new CustomToolbar();
toolBar.addButton(pseudoClassToggle);
titlePanel.add(toolBar);
headerPanel.add(titlePanel, BorderLayout.PAGE_START);
headerPanel.add(createPseudoClassPanel(pseudoClassToggle), BorderLayout.CENTER);
propertyPanePanel.add(headerPanel, BorderLayout.PAGE_START);
propertyPaneManager = propertyPanePanel.getExplorerManager();
propertyPanePanel.setMinimumSize(new Dimension(0,0)); // allow shrinking in JSplitPane
return propertyPanePanel;
}
protected final void refreshLabelWidths() {
int maximumLabelWidth = computeLeftPanelMaximumLabelWidth();
for (int i=0; i<this.parameterComponents.size(); i++) {
JLabel label = this.parameterComponents.get(i).getLabel();
Dimension labelSize = label.getPreferredSize();
labelSize.width = maximumLabelWidth;
label.setPreferredSize(labelSize);
label.setMinimumSize(labelSize);
}
}
public static JLabel createIcon(final Icon icon, final String toolTip) {
JLabel jLabel = new JLabel();
jLabel.setIcon(icon);
jLabel.setForeground(jLabel.getBackground().darker().darker().darker());
jLabel.setMinimumSize(new Dimension(25, 25));
jLabel.setPreferredSize(new Dimension(25, 25));
jLabel.setMaximumSize(new Dimension(25, 25));
jLabel.setHorizontalAlignment(JLabel.CENTER);
jLabel.setToolTipText(toolTip);
return jLabel;
}
private void addSpace(final int width) {
JLabel jSpace = new JLabel();
jSpace.setMinimumSize(new Dimension(width, 25));
jSpace.setPreferredSize(new Dimension(width, 25));
jSpace.setMaximumSize(new Dimension(width, 25));
jToolBar.add(jSpace);
}
@Override
public Component getComponent(int width, int height) throws IOException {
final JPanel base = new JPanel();
base.setOpaque(false);
base.setPreferredSize(new Dimension(width, height));
base.setLayout(new BoxLayout(base, BoxLayout.Y_AXIS));
chart = ChartFactory.createScatterPlot("", "", "", dataset, PlotOrientation.VERTICAL, false, false, false);
final XYItemRenderer renderer = new XYLineAndShapeRenderer(false, true) {
private static final long serialVersionUID = 1L;
@Override
public ItemLabelPosition getPositiveItemLabelPosition(int row, int column) {
return new ItemLabelPosition(ItemLabelAnchor.OUTSIDE6, TextAnchor.TOP_LEFT);
}
};
final Font font = Font.decode("Helvetica Neue-22");
renderer.setBaseItemLabelFont(font);
chart.getXYPlot().setRenderer(renderer);
// chart.getXYPlot().getDomainAxis().setRange(-0.5, 5.5)
chart.getXYPlot().getDomainAxis().setTickLabelFont(font);
// chart.getXYPlot().getDomainAxis().setTickUnit(new NumberTickUnit(1))
// chart.getXYPlot().getRangeAxis().setRange(-0.5, 5.5)
chart.getXYPlot().getRangeAxis().setTickLabelFont(font);
// chart.getXYPlot().getRangeAxis().setTickUnit(new NumberTickUnit(1))
chart.getXYPlot().getRenderer().setBaseItemLabelGenerator(new StandardXYItemLabelGenerator() {
private static final long serialVersionUID = 1L;
@Override
public String generateLabel(XYDataset ds, int series, int item) {
return ((Dataset) ds).getLabel(series, item);
};
});
chart.getXYPlot().getRenderer().setBaseItemLabelsVisible(true);
chartPanel = new ChartPanel(chart);
chart.setBackgroundPaint(new java.awt.Color(255, 255, 255, 255));
chart.getXYPlot().setBackgroundPaint(java.awt.Color.WHITE);
chart.getXYPlot().setRangeGridlinePaint(java.awt.Color.GRAY);
chart.getXYPlot().setDomainGridlinePaint(java.awt.Color.GRAY);
chartPanel.setSize(width, height - 50);
chartPanel.setPreferredSize(chartPanel.getSize());
base.add(chartPanel);
final JPanel controls = new JPanel();
controls.setPreferredSize(new Dimension(width, 50));
controls.setMaximumSize(new Dimension(width, 50));
controls.setSize(new Dimension(width, 50));
controls.add(new JSeparator(SwingConstants.VERTICAL));
runBtn = new JButton("Run t-SNE");
runBtn.setActionCommand("button.run");
runBtn.addActionListener(this);
controls.add(runBtn);
controls.add(new JSeparator(SwingConstants.VERTICAL));
cnclBtn = new JButton("Cancel");
cnclBtn.setEnabled(false);
cnclBtn.setActionCommand("button.cancel");
cnclBtn.addActionListener(this);
controls.add(cnclBtn);
base.add(controls);
controls.add(new JSeparator(SwingConstants.VERTICAL));
iterLabel = new JLabel(" ");
final Dimension size = iterLabel.getPreferredSize();
iterLabel.setMinimumSize(size);
iterLabel.setPreferredSize(size);
controls.add(iterLabel);
updateImage();
return base;
}
LootTrackerBox(
final long timeStamp,
final ItemManager itemManager,
final String id,
final LootRecordType lootRecordType,
@Nullable final String subtitle,
final boolean hideIgnoredItems,
final LootTrackerPriceType priceType,
final boolean showPriceType,
@Nullable final Boolean showDate,
final BiConsumer<String, Boolean> onItemToggle,
final BiConsumer<String, Boolean> onEventToggle,
final boolean eventIgnored)
{
this.id = id;
this.lootRecordType = lootRecordType;
this.itemManager = itemManager;
this.onItemToggle = onItemToggle;
this.hideIgnoredItems = hideIgnoredItems;
this.priceType = priceType;
this.showPriceType = showPriceType;
setLayout(new BorderLayout(0, 1));
setBorder(new EmptyBorder(5, 0, 0, 0));
logTitle.setLayout(new BoxLayout(logTitle, BoxLayout.X_AXIS));
logTitle.setBorder(new EmptyBorder(7, 7, 7, 7));
logTitle.setBackground(eventIgnored ? ColorScheme.DARKER_GRAY_HOVER_COLOR : ColorScheme.DARKER_GRAY_COLOR.darker());
JLabel titleLabel = new JLabel();
titleLabel.setText(Text.removeTags(id));
titleLabel.setFont(FontManager.getRunescapeSmallFont());
titleLabel.setForeground(Color.WHITE);
// Set a size to make BoxLayout truncate the name
titleLabel.setMinimumSize(new Dimension(1, titleLabel.getPreferredSize().height));
logTitle.add(titleLabel);
subTitleLabel.setFont(FontManager.getRunescapeSmallFont());
subTitleLabel.setForeground(ColorScheme.LIGHT_GRAY_COLOR);
JLabel dateLabel = new JLabel();
dateLabel.setFont(FontManager.getRunescapeSmallFont().deriveFont(Font.PLAIN, FontManager.getRunescapeSmallFont().getSize() - 2));
dateLabel.setForeground(Color.LIGHT_GRAY);
dateLabel.setText(DateFormat.getDateInstance().format(new Date(timeStamp)));
if (showDate)
{
logTitle.add(dateLabel, BorderLayout.SOUTH);
}
if (!Strings.isNullOrEmpty(subtitle))
{
subTitleLabel.setText(subtitle);
}
logTitle.add(Box.createRigidArea(new Dimension(TITLE_PADDING, 0)));
logTitle.add(subTitleLabel);
logTitle.add(Box.createHorizontalGlue());
logTitle.add(Box.createRigidArea(new Dimension(TITLE_PADDING, 0)));
priceLabel.setFont(FontManager.getRunescapeSmallFont());
priceLabel.setForeground(ColorScheme.LIGHT_GRAY_COLOR);
logTitle.add(priceLabel);
add(logTitle, BorderLayout.NORTH);
add(itemContainer, BorderLayout.CENTER);
// Create popup menu for ignoring the loot event
final JPopupMenu popupMenu = new JPopupMenu();
popupMenu.setBorder(new EmptyBorder(5, 5, 5, 5));
this.setComponentPopupMenu(popupMenu);
final JMenuItem toggle = new JMenuItem(eventIgnored ? "Include group" : "Ignore group");
toggle.addActionListener(e -> onEventToggle.accept(id, !eventIgnored));
popupMenu.add(toggle);
}
public ReprocessedTab(final Program program) {
super(program, TabsReprocessed.get().title(), Images.TOOL_REPROCESSED.getIcon(), true);
JFixedToolBar jToolBarLeft = new JFixedToolBar();
JButton jClear = new JButton(TabsReprocessed.get().removeAll(), Images.EDIT_DELETE.getIcon());
jClear.setActionCommand(ReprocessedAction.CLEAR.name());
jClear.addActionListener(listener);
jToolBarLeft.addButton(jClear);
jToolBarLeft.addSpace(30);
JLabel jInfo = new JLabel(TabsReprocessed.get().info());
jInfo.setMinimumSize(new Dimension(100, Program.getButtonsHeight()));
jInfo.setMaximumSize(new Dimension(Short.MAX_VALUE, Program.getButtonsHeight()));
jInfo.setHorizontalAlignment(SwingConstants.LEFT);
jToolBarLeft.add(jInfo);
JFixedToolBar jToolBarRight = new JFixedToolBar();
JButton jCollapse = new JButton(TabsReprocessed.get().collapse(), Images.MISC_COLLAPSED.getIcon());
jCollapse.setActionCommand(ReprocessedAction.COLLAPSE.name());
jCollapse.addActionListener(listener);
jToolBarRight.addButton(jCollapse);
JButton jExpand = new JButton(TabsReprocessed.get().expand(), Images.MISC_EXPANDED.getIcon());
jExpand.setActionCommand(ReprocessedAction.EXPAND.name());
jExpand.addActionListener(listener);
jToolBarRight.addButton(jExpand);
//Table Format
tableFormat = new EnumTableFormatAdaptor<>(ReprocessedTableFormat.class);
//Backend
eventList = EventListManager.create();
//Sorting (per column)
eventList.getReadWriteLock().readLock().lock();
SortedList<ReprocessedInterface> sortedListColumn = new SortedList<>(eventList);
eventList.getReadWriteLock().readLock().unlock();
//Sorting Total (Ensure that total is always last)
eventList.getReadWriteLock().readLock().lock();
SortedList<ReprocessedInterface> sortedListTotal = new SortedList<>(sortedListColumn, new TotalComparator());
eventList.getReadWriteLock().readLock().unlock();
//Filter
eventList.getReadWriteLock().readLock().lock();
filterList = new FilterList<>(sortedListTotal);
eventList.getReadWriteLock().readLock().unlock();
//Separator
separatorList = new SeparatorList<>(filterList, new ReprocessedSeparatorComparator(), 1, Integer.MAX_VALUE);
//Table Model
tableModel = EventModels.createTableModel(separatorList, tableFormat);
//Table
jTable = new JReprocessedTable(program, tableModel, separatorList);
jTable.setSeparatorRenderer(new ReprocessedSeparatorTableCell(jTable, separatorList, listener));
jTable.setSeparatorEditor(new ReprocessedSeparatorTableCell(jTable, separatorList, listener));
jTable.setCellSelectionEnabled(true);
PaddingTableCellRenderer.install(jTable, 3);
//Sorting
TableComparatorChooser.install(jTable, sortedListColumn, TableComparatorChooser.MULTIPLE_COLUMN_MOUSE, tableFormat);
//Selection Model
selectionModel = EventModels.createSelectionModel(separatorList);
selectionModel.setSelectionMode(ListSelection.MULTIPLE_INTERVAL_SELECTION_DEFENSIVE);
jTable.setSelectionModel(selectionModel);
//Listeners
installTable(jTable, NAME);
//Scroll
JScrollPane jTableScroll = new JScrollPane(jTable);
//Table Filter
filterControl = new ReprocessedFilterControl(
tableFormat,
program.getMainWindow().getFrame(),
eventList,
sortedListTotal,
filterList,
Settings.get().getTableFilters(NAME)
);
//Menu
installMenu(program, new ReprocessedTableMenu(), jTable, ReprocessedInterface.class);
layout.setHorizontalGroup(
layout.createParallelGroup(GroupLayout.Alignment.TRAILING)
.addComponent(filterControl.getPanel())
.addGroup(layout.createSequentialGroup()
.addComponent(jToolBarLeft, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, Integer.MAX_VALUE)
.addGap(0)
.addComponent(jToolBarRight)
)
.addComponent(jTableScroll, 0, 0, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createSequentialGroup()
.addComponent(filterControl.getPanel())
.addGroup(layout.createParallelGroup()
.addComponent(jToolBarLeft, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
.addComponent(jToolBarRight, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
)
.addComponent(jTableScroll, 0, 0, Short.MAX_VALUE)
);
}
private static void setLabelSize(JLabel label, int maximumLabelWidth) {
Dimension labelSize = label.getPreferredSize();
labelSize.width = maximumLabelWidth;
label.setPreferredSize(labelSize);
label.setMinimumSize(labelSize);
}
@Override
public Component getComponent(int width, int height) throws IOException {
final JPanel base = new JPanel();
base.setOpaque(false);
base.setPreferredSize(new Dimension(width, height));
base.setLayout(new BoxLayout(base, BoxLayout.Y_AXIS));
chart = ChartFactory.createScatterPlot("", "", "", dataset, PlotOrientation.VERTICAL, false, false, false);
final XYItemRenderer renderer = new XYLineAndShapeRenderer(false, true) {
private static final long serialVersionUID = 1L;
@Override
public ItemLabelPosition getPositiveItemLabelPosition(int row, int column) {
return new ItemLabelPosition(ItemLabelAnchor.OUTSIDE6, TextAnchor.TOP_LEFT);
}
};
final Font font = Font.decode("Helvetica Neue-22");
renderer.setBaseItemLabelFont(font);
chart.getXYPlot().setRenderer(renderer);
// chart.getXYPlot().getDomainAxis().setRange(-0.5, 5.5)
chart.getXYPlot().getDomainAxis().setTickLabelFont(font);
// chart.getXYPlot().getDomainAxis().setTickUnit(new NumberTickUnit(1))
// chart.getXYPlot().getRangeAxis().setRange(-0.5, 5.5)
chart.getXYPlot().getRangeAxis().setTickLabelFont(font);
// chart.getXYPlot().getRangeAxis().setTickUnit(new NumberTickUnit(1))
chart.getXYPlot().getRenderer().setBaseItemLabelGenerator(new StandardXYItemLabelGenerator() {
private static final long serialVersionUID = 1L;
@Override
public String generateLabel(XYDataset ds, int series, int item) {
return ((Dataset) ds).getLabel(series, item);
};
});
chart.getXYPlot().getRenderer().setBaseItemLabelsVisible(true);
chartPanel = new ChartPanel(chart);
chart.setBackgroundPaint(new java.awt.Color(255, 255, 255, 255));
chart.getXYPlot().setBackgroundPaint(java.awt.Color.WHITE);
chart.getXYPlot().setRangeGridlinePaint(java.awt.Color.GRAY);
chart.getXYPlot().setDomainGridlinePaint(java.awt.Color.GRAY);
chartPanel.setSize(width, height - 50);
chartPanel.setPreferredSize(chartPanel.getSize());
base.add(chartPanel);
final JPanel controls = new JPanel();
controls.setPreferredSize(new Dimension(width, 50));
controls.setMaximumSize(new Dimension(width, 50));
controls.setSize(new Dimension(width, 50));
controls.add(new JSeparator(SwingConstants.VERTICAL));
controls.add(new JLabel("Distance:"));
distCombo = new JComboBox<String>();
distCombo.addItem("Euclidean");
distCombo.addItem("1-Pearson");
distCombo.addItem("1-Cosine");
controls.add(distCombo);
controls.add(new JSeparator(SwingConstants.VERTICAL));
runBtn = new JButton("Run MDS");
runBtn.setActionCommand("button.run");
runBtn.addActionListener(this);
controls.add(runBtn);
controls.add(new JSeparator(SwingConstants.VERTICAL));
cnclBtn = new JButton("Cancel");
cnclBtn.setEnabled(false);
cnclBtn.setActionCommand("button.cancel");
cnclBtn.addActionListener(this);
controls.add(cnclBtn);
base.add(controls);
controls.add(new JSeparator(SwingConstants.VERTICAL));
iterLabel = new JLabel(" ");
final Dimension size = iterLabel.getPreferredSize();
iterLabel.setMinimumSize(size);
iterLabel.setPreferredSize(size);
controls.add(iterLabel);
updateImage();
return base;
}
/**
* Initializes the GUI.
*/
private void initGUI() {
realOuterPanel = new JPanel(new BorderLayout());
outerLayer = new JLayer<JPanel>(realOuterPanel);
savingGlassPane = new TransparentGlassPanePanel(WAITING_ICON,
I18N.getGUILabel("configurable_dialog.saving_configurables"), getBackground(), 0.5f);
outerLayer.setGlassPane(savingGlassPane);
savingGlassPane.setVisible(false);
JPanel pagePanel = new JPanel(new BorderLayout());
// list of configurables
JPanel configPanel = createConfigPanel();
// force size so it does not resize itself depending on entered values
configPanel.setMinimumSize(CONFIG_LIST_SIZE);
configPanel.setMaximumSize(CONFIG_LIST_SIZE);
configPanel.setPreferredSize(CONFIG_LIST_SIZE);
buttonPanel = createConfigurableButtonPanel();
// create middle spacer
JLabel spacer = new JLabel();
spacer.setMinimumSize(DIMENSION_SPACER_MIDDLE);
spacer.setMaximumSize(DIMENSION_SPACER_MIDDLE);
spacer.setPreferredSize(DIMENSION_SPACER_MIDDLE);
// add both to an outer panel for layout reasons
JPanel outerConfigPanel = new JPanel(new BorderLayout());
outerConfigPanel.setBorder(BorderFactory.createMatteBorder(0, 1, 1, 1, Color.LIGHT_GRAY));
outerConfigPanel.add(configPanel, BorderLayout.CENTER);
outerConfigPanel.add(buttonPanel, BorderLayout.SOUTH);
// another panel for layouting
JPanel outermostConfigPanel = new JPanel(new BorderLayout());
outermostConfigPanel.add(outerConfigPanel, BorderLayout.CENTER);
outermostConfigPanel.add(spacer, BorderLayout.EAST);
// glass pane showed if the user is not able to edit connections due to an old version of
// the server
simpleGlassPane = new TransparentGlassPanePanel(null, null, getBackground(), 0.5f);
// panel displaying the selected configurable
JPanel paramPanel = createParameterPanel();
GridBagConstraints c = new GridBagConstraints();
c.fill = GridBagConstraints.BOTH;
c.weightx = 1;
c.weighty = 0.3;
c.gridwidth = GridBagConstraints.REMAINDER;
// add panels to page panel
pagePanel.add(outermostConfigPanel, BorderLayout.WEST);
pagePanel.add(paramPanel, BorderLayout.CENTER);
// add page and button panel to outer panel
realOuterPanel.add(pagePanel, BorderLayout.CENTER);
layoutDefault(outerLayer, makeSaveButton(), makeCancel());
new DeprecationWarning("manage_configurables").addToDialog(this);
setDefaultSize(ButtonDialog.HUGE);
setLocationRelativeTo(ApplicationFrame.getApplicationFrame());
setModal(true);
setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
cancelButton.doClick();
}
});
updateButtonState(true);
}