本文整理汇总了Java中javax.swing.JButton.setMinimumSize方法的典型用法代码示例。如果您正苦于以下问题:Java JButton.setMinimumSize方法的具体用法?Java JButton.setMinimumSize怎么用?Java JButton.setMinimumSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JButton
的用法示例。
在下文中一共展示了JButton.setMinimumSize方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: jPanel_srEquipmentBrowseCategoriesComponentShown
import javax.swing.JButton; //导入方法依赖的package包/类
private void jPanel_srEquipmentBrowseCategoriesComponentShown(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_jPanel_srEquipmentBrowseCategoriesComponentShown
if (!initializedEquipmentBrowse) {
List<String> categories = mil2525CSymbolController.getCategories();
for (final String category : categories) {
final JButton button = new JButton(category);
button.setFont(BUTTON_FONT);
button.setHorizontalAlignment(SwingConstants.LEFT);
button.setFocusable(false);
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
selectedCategory = category;
equipmentListJPanel_srEquipmentCategoryResults.removeAll();
jLabel_srEquipmentCategory.setText(selectedCategory);
showCard("Spot Report Equipment Category Card");
}
});
button.setMaximumSize(new Dimension(Integer.MAX_VALUE, 60));
button.setMinimumSize(new Dimension(0, 60));
jPanel_srEquipmentCategories.add(button);
}
initializedEquipmentBrowse = true;
}
}
示例2: createDataSourceSelectionButton
import javax.swing.JButton; //导入方法依赖的package包/类
private JButton createDataSourceSelectionButton(@SuppressWarnings("rawtypes") final DataSourceFactory factory) {
String label = DataImportWizardUtils.getFactoryLabel(factory);
String description = DataImportWizardUtils.getFactoryDescription(factory);
JButton typeSelectionButton = new JButton(new AbstractAction() {
private static final long serialVersionUID = 1L;
@Override
@SuppressWarnings("unchecked")
public void actionPerformed(ActionEvent e) {
enableDataSourceButtons(false);
// update the wizard by setting the selected factory
wizard.setDataSource(factory.createNew(), factory);
// switch to the next wizard step (location selection)
wizard.nextStep();
}
});
typeSelectionButton.setText(label);
typeSelectionButton.setToolTipText(description);
typeSelectionButton.setMinimumSize(TYPE_BUTTON_DIMENSION);
typeSelectionButton.setPreferredSize(TYPE_BUTTON_DIMENSION);
typeSelectionButton.setMaximumSize(TYPE_BUTTON_DIMENSION);
typeSelectionButton.setIcon(DataImportWizardUtils.getFactoryIcon(factory));
return typeSelectionButton;
}
示例3: IOObjectCacheEntryPanel
import javax.swing.JButton; //导入方法依赖的package包/类
/**
* Creates a new {@link IOObjectCacheEntryPanel}.
*
* @param icon
* The {@link Icon} associated with the entry's type.
* @param entryType
* Human readable representation of the entry's type (e.g., 'Data Table').
* @param openAction
* The action to be performed when clicking in the entry.
* @param removeAction
* An action triggering the removal of the entry.
*/
public IOObjectCacheEntryPanel(Icon icon, String entryType, Action openAction, Action removeAction) {
super(ENTRY_LAYOUT);
this.openAction = openAction;
// add icon label
JLabel iconLabel = new JLabel(icon);
add(iconLabel, ICON_CONSTRAINTS);
// add object type label
JLabel typeLabel = new JLabel(entryType);
typeLabel.setMaximumSize(new Dimension(MAX_TYPE_WIDTH, 24));
typeLabel.setPreferredSize(typeLabel.getMaximumSize());
typeLabel.setToolTipText(entryType);
add(typeLabel, TYPE_CONSTRAINTS);
// add link button performing the specified action, the label displays the entry's key name
LinkLocalButton openButton = new LinkLocalButton(openAction);
openButton.setMargin(new Insets(0, 0, 0, 0));
add(openButton, KEY_CONSTRAINTS);
// add removal button
JButton removeButton = new JButton(removeAction);
removeButton.setBorderPainted(false);
removeButton.setOpaque(false);
removeButton.setMinimumSize(buttonSize);
removeButton.setPreferredSize(buttonSize);
removeButton.setContentAreaFilled(false);
removeButton.setText(null);
add(removeButton, REMOVE_BUTTON_CONSTRAINTS);
// register mouse listeners
addMouseListener(hoverMouseListener);
iconLabel.addMouseListener(dispatchMouseListener);
typeLabel.addMouseListener(dispatchMouseListener);
openButton.addMouseListener(dispatchMouseListener);
removeButton.addMouseListener(dispatchMouseListener);
}
示例4: initComponents
import javax.swing.JButton; //导入方法依赖的package包/类
/**
* Initialize all components of this panel
*/
private void initComponents() {
setLayout(new BorderLayout(5, 5));
this.setBorder(new EmptyBorder(20, 20, 20, 20));
// Builds upper panel
JPanel upperPanel = new JPanel(new BorderLayout());
JLabel description = new JLabel(BLOCKING_DESCRIPTION);
upperPanel.add(description, BorderLayout.CENTER);
//build upper right corner of the main panel
JPanel upRightPanel = new JPanel(new BorderLayout());
addRegion = new JButton("Add Region");
addRegion.setMinimumSize(DIM_BUTTON_S);
upRightPanel.add(addRegion, BorderLayout.CENTER);
upperPanel.add(upRightPanel, BorderLayout.EAST);
//build spinner panel
JPanel spinnerPanel = new JPanel();
JLabel spinnerDescrLabel = new JLabel("Regions:");
regionsNumSpinner = new JSpinner();
regionsNumSpinner.setPreferredSize(DIM_BUTTON_XS);
spinnerPanel.add(spinnerDescrLabel);
spinnerPanel.add(regionsNumSpinner);
upRightPanel.add(spinnerPanel, BorderLayout.SOUTH);
add(upperPanel, BorderLayout.NORTH);
// Creates blocking regions list
regions = new RegionTable();
JScrollPane jsp = new JScrollPane(regions, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
jsp.setPreferredSize(new Dimension(500, 200));
add(jsp, BorderLayout.WEST);
update();
}
示例5: setEquipmentNames
import javax.swing.JButton; //导入方法依赖的package包/类
/**
* Sets the names of the equipment for which buttons should display.
* @param equipmentNames the names of the equipment for which buttons should display.
*/
public void setEquipmentNames(List<String> equipmentNames) {
removeAll();
for (final String name : equipmentNames) {
JButton button = new JButton(name) {
@Override
public void paint(Graphics g) {
if (null == getIcon()) {
//Doing this here because it's expensive, so only
//do it when we actually need it.
setIcon(new ImageIcon(mil2525CSymbolController.getSymbolImage(name)));
}
super.paint(g);
}
};
button.setFont(BUTTON_FONT);
button.setHorizontalAlignment(SwingConstants.LEFT);
button.setFocusable(false);
button.setMaximumSize(new Dimension(Integer.MAX_VALUE, 60));
button.setMinimumSize(new Dimension(0, 60));
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
for (ActionListener listener : listeners) {
listener.actionPerformed(e);
}
}
});
add(button);
}
}
示例6: initComponents
import javax.swing.JButton; //导入方法依赖的package包/类
private void initComponents() {
setLayout(new BorderLayout(3, 3));
setBorder(new EmptyBorder(5, 5, 5, 5));
addModeButton = new JButton("Add Mode");
addModeButton.setMinimumSize(DIM_BUTTON_M);
OptionTable = new TimingOptionTable();
JScrollPane OptionPane = new JScrollPane(OptionTable);
OptionPane.setBorder(new TitledBorder(new EtchedBorder(), "Timing Options"));
add(addModeButton, BorderLayout.NORTH);
add(OptionPane, BorderLayout.CENTER);
}
示例7: initGUI
import javax.swing.JButton; //导入方法依赖的package包/类
private void initGUI(String title) {
centerWindow(CommonConstants.MAX_GUI_WIDTH_LDROUTING, CommonConstants.MAX_GUI_HEIGHT_LDROUTING);
setTitle(title);
// Adds "Add Range" Button
JPanel topPanel = new JPanel(new BorderLayout());
JPanel rightTopPanel = new JPanel(new BorderLayout());
JButton addRange = new JButton(addRangeAction);
addRange.setMinimumSize(DIM_BUTTON_S);
rightTopPanel.add(addRange, BorderLayout.EAST);
topPanel.add(rightTopPanel, BorderLayout.NORTH);
JPanel LDPanel = new JPanel(new BorderLayout());
LDPanel.add(topPanel, BorderLayout.NORTH);
// Adds StrategyTable
rangesTable = new LoadDependentRoutingStrategyTable();
JScrollPane scrollPane = new JScrollPane(rangesTable);
LDPanel.add(scrollPane, BorderLayout.CENTER);
JTabbedPane mainPanel = new JTabbedPane();
JPanel bottomPanel = new JPanel(new FlowLayout());
// Adds Okay button to bottom_panel
JButton okayButton = new JButton(okayAction);
bottomPanel.add(okayButton);
mainPanel.addTab("Edit", LDPanel);
getContentPane().setLayout(new BorderLayout());
getContentPane().add(mainPanel, BorderLayout.CENTER);
getContentPane().add((bottomPanel), BorderLayout.SOUTH);
refreshComponents();
}
示例8: initComponents
import javax.swing.JButton; //导入方法依赖的package包/类
/**
* Initialize all components of this panel
*/
private void initComponents() {
setLayout(new BorderLayout(5, 5));
this.setBorder(new EmptyBorder(20, 20, 20, 20));
// Builds upper panel
JPanel upperPanel = new JPanel(new BorderLayout());
JLabel description = new JLabel(BLOCKING_DESCRIPTION);
upperPanel.add(description, BorderLayout.CENTER);
//build upper right corner of the main panel
JPanel upRightPanel = new JPanel(new BorderLayout());
addRegion = new JButton("Add Region");
addRegion.setMinimumSize(DIM_BUTTON_S);
upRightPanel.add(addRegion, BorderLayout.CENTER);
upperPanel.add(upRightPanel, BorderLayout.EAST);
//build spinner panel
JPanel spinnerPanel = new JPanel();
JLabel spinnerDescrLabel = new JLabel("Regions:");
regionsNumSpinner = new JSpinner();
regionsNumSpinner.setPreferredSize(DIM_BUTTON_XS);
spinnerPanel.add(spinnerDescrLabel);
spinnerPanel.add(regionsNumSpinner);
upRightPanel.add(spinnerPanel, BorderLayout.SOUTH);
add(upperPanel, BorderLayout.NORTH);
// Creates blocking regions list
regions = new RegionTable();
regions.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
JScrollPane jsp = new JScrollPane(regions, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
jsp.setPreferredSize(new Dimension(220, 200));
add(jsp, BorderLayout.WEST);
update();
}
示例9: initComponent
import javax.swing.JButton; //导入方法依赖的package包/类
/**
* Initialize all gui related stuff
*/
private void initComponent() {
setLayout(new GridLayout(2, 1));
stationPanel = new JPanel(new BorderLayout(5, 5));
stationPanel.setBorder(BorderFactory.createTitledBorder(new EtchedBorder(), "Stations in " + bd.getRegionName(regionKey)));
// Creates panel with add station button and spinner
JPanel addPanel = new JPanel(new BorderLayout());
addStation = new JButton("Add Station");
addStation.setToolTipText("Adds a station to selected blocking region");
addStation.setMinimumSize(DIM_BUTTON_S);
addPanel.add(addStation, BorderLayout.CENTER);
//build spinner panel
JPanel spinnerPanel = new JPanel();
JLabel spinnerDescrLabel = new JLabel("Stations:");
stationNumSpinner = new JSpinner();
stationNumSpinner.setPreferredSize(DIM_BUTTON_XS);
spinnerPanel.add(spinnerDescrLabel);
spinnerPanel.add(stationNumSpinner);
addPanel.add(spinnerPanel, BorderLayout.SOUTH);
// Creates a tmp panel to put addStation panel on the northeast corner
JPanel tmpPanel = new JPanel(new BorderLayout());
tmpPanel.add(addPanel, BorderLayout.NORTH);
stationPanel.add(tmpPanel, BorderLayout.EAST);
// Creates table to display stations
stationTable = new StationTable();
WarningScrollTable warning = new WarningScrollTable(stationTable, WARNING_STATIONS);
warning.addCheckVector(sd.getStationKeysNoSourceSink());
stationPanel.add(warning);
add(stationPanel);
// Creates blocking region panel
blockingPanel = new BlockingRegionParameterPanel(cd, bd, regionKey);
// Hides unneeded global properties (specified by table)
blockingPanel.setGlobalVisible(false);
add(blockingPanel);
}
示例10: createGUI
import javax.swing.JButton; //导入方法依赖的package包/类
protected void createGUI()
{
GridBagLayout gridbag = new GridBagLayout();
GridBagConstraints c = new GridBagConstraints();
setLayout(gridbag);
setMaximumSize(new Dimension(Short.MAX_VALUE, Short.MAX_VALUE));
target = new JTextField();
target.setEditable(false);
target.setMinimumSize(new Dimension(150, 20));
target.setPreferredSize(new Dimension(150, 20));
target.setMaximumSize(new Dimension(150, 20));
c.gridx = 0;
c.weightx = 1;
c.gridy = 0;
c.fill = GridBagConstraints.HORIZONTAL;
gridbag.setConstraints(target, c);
add(target);
search = new JButton("...");
search.setFont(new Font("Sans Serif", Font.PLAIN, 8));
search.addActionListener(this);
search.setMinimumSize(new Dimension(18, 20));
search.setPreferredSize(new Dimension(18, 20));
search.setMaximumSize(new Dimension(18, 20));
c.gridx = 1;
c.weightx = 0;
gridbag.setConstraints(search, c);
add(search);
}
示例11: createGUI
import javax.swing.JButton; //导入方法依赖的package包/类
private void createGUI()
{
GridBagLayout gridbag = new GridBagLayout();
GridBagConstraints c = new GridBagConstraints();
setLayout(gridbag);
setMaximumSize(new Dimension(Short.MAX_VALUE, Short.MAX_VALUE));
target = new JTextField();
target.setEditable(false);
target.setMinimumSize(new Dimension(150, 20));
target.setPreferredSize(new Dimension(150, 20));
target.setMaximumSize(new Dimension(150, 20));
c.gridx = 0;
c.weightx = 1;
c.gridy = 0;
c.fill = GridBagConstraints.HORIZONTAL;
gridbag.setConstraints(target, c);
add(target);
JButton search = new JButton("..."); //$NON-NLS-1$
search.setFont(new Font("Sans Serif", Font.PLAIN, 8)); //$NON-NLS-1$
search.addActionListener(new SearchHandler());
search.setMinimumSize(new Dimension(18, 20));
search.setPreferredSize(new Dimension(18, 20));
search.setMaximumSize(new Dimension(18, 20));
c.gridx = 1;
c.weightx = 0;
gridbag.setConstraints(search, c);
add(search);
}
示例12: createButton
import javax.swing.JButton; //导入方法依赖的package包/类
/**
* Creates button with given text.
*
* @param text
* Button text.
* @return Instance of {@link JButton}.
*/
private JButton createButton(String text) {
JButton button = new JButton(text);
button.setMinimumSize(new Dimension(40, 40));
button.setPreferredSize(new Dimension(75, 60));
button.setFont(new Font(button.getFont().toString(), Font.BOLD, 15));
buttonMap.put(text, button);
return button;
}
示例13: initComponents
import javax.swing.JButton; //导入方法依赖的package包/类
protected void initComponents() {
//create margins for this panel.
Box vBox = Box.createVerticalBox();
Box hBox = Box.createHorizontalBox();
vBox.add(Box.createVerticalStrut(30));
vBox.add(hBox);
vBox.add(Box.createVerticalStrut(30));
hBox.add(Box.createHorizontalStrut(20));
//build central panel
JPanel componentsPanel = new JPanel(new BorderLayout());
//new BoxLayout(componentsPanel, BoxLayout.Y_AXIS);
//build upper part of central panel
JPanel upperPanel = new JPanel(new BorderLayout());
JLabel descrLabel = new JLabel(CLASSES_DESCRIPTION);
//descrLabel.setMaximumSize(new Dimension(300, 1000));
upperPanel.add(descrLabel, BorderLayout.CENTER);
//build upper right corner of the main panel
JPanel upRightPanel = new JPanel(new BorderLayout());
addClass = new JButton(addNewClass);
addClass.setMinimumSize(DIM_BUTTON_S);
addClass.setMaximumSize(DIM_BUTTON_S);
upRightPanel.add(addClass, BorderLayout.NORTH);
//build spinner panel
JPanel spinnerPanel = new JPanel();
JLabel spinnerDescrLabel = new JLabel("Classes:");
//rangesNumSpinner = new JSpinner();
classNumSpinner.setPreferredSize(DIM_BUTTON_XS);
spinnerPanel.add(spinnerDescrLabel);
spinnerPanel.add(classNumSpinner);
//add all panels to the mail panel
upRightPanel.add(spinnerPanel, BorderLayout.CENTER);
upperPanel.add(upRightPanel, BorderLayout.EAST);
componentsPanel.add(upperPanel, BorderLayout.NORTH);
componentsPanel.add(new JScrollPane(classTable), BorderLayout.CENTER);
hBox.add(componentsPanel);
hBox.add(Box.createHorizontalStrut(20));
this.setLayout(new GridLayout(1, 1));
this.add(vBox);
}
示例14: initComponents
import javax.swing.JButton; //导入方法依赖的package包/类
private void initComponents() {
//create margins for this panel.
Box vBox = Box.createVerticalBox();
Box hBox = Box.createHorizontalBox();
vBox.add(Box.createVerticalStrut(30));
vBox.add(hBox);
vBox.add(Box.createVerticalStrut(30));
hBox.add(Box.createHorizontalStrut(20));
//build central panel
JPanel componentsPanel = new JPanel(new BorderLayout());
//new BoxLayout(componentsPanel, BoxLayout.Y_AXIS);
//build upper part of central panel
JPanel upperPanel = new JPanel(new BorderLayout());
JLabel descrLabel = new JLabel(STATIONS_DESCRIPTION);
//descrLabel.setMaximumSize(new Dimension(300, 1000));
upperPanel.add(descrLabel, BorderLayout.CENTER);
//build upper right corner of the main panel
JPanel upRightPanel = new JPanel(new BorderLayout());
addStation = new JButton(addNewStation);
addStation.setMinimumSize(DIM_BUTTON_S);
upRightPanel.add(addStation, BorderLayout.CENTER);
//build spinner panel
JPanel spinnerPanel = new JPanel();
JLabel spinnerDescrLabel = new JLabel("Stations:");
//stationNumSpinner = new JSpinner();
stationNumSpinner.setPreferredSize(DIM_BUTTON_XS);
spinnerPanel.add(spinnerDescrLabel);
spinnerPanel.add(stationNumSpinner);
//add all panels to the mail panel
upRightPanel.add(spinnerPanel, BorderLayout.SOUTH);
upperPanel.add(upRightPanel, BorderLayout.EAST);
componentsPanel.add(upperPanel, BorderLayout.NORTH);
componentsPanel.add(new JScrollPane(stationTable), BorderLayout.CENTER);
hBox.add(componentsPanel);
hBox.add(Box.createHorizontalStrut(20));
this.setLayout(new GridLayout(1, 1));
this.add(vBox);
}
示例15: initComponents
import javax.swing.JButton; //导入方法依赖的package包/类
private void initComponents() {
setLayout(new BorderLayout());
String modeName = stationData.getTransitionModeName(stationKey, 0);
firingBorder = new TitledBorder(new EtchedBorder(), "Firing Outcome for " + modeName);
firingTable = new FiringOutcomeTable();
firingPane = new JScrollPane(firingTable);
firingPane.setBorder(firingBorder);
firingPane.setMinimumSize(new Dimension(300, 240));
leftPanel = new WarningScrollTable(firingPane, WARNING_CLASS_OUTGOING_ROUTING);
leftPanel.addCheckVector(stationOutKeys);
leftPanel.addCheckVector(classKeys);
addModeButton = new JButton("Add Mode");
addModeButton.setMinimumSize(DIM_BUTTON_M);
modeTable = new ModeTable();
JPanel modePanel = new JPanel(new BorderLayout(5, 5));
modePanel.setBorder(new TitledBorder(new EtchedBorder(), "Modes"));
modePanel.setMinimumSize(new Dimension(200, 120));
modePanel.add(addModeButton, BorderLayout.NORTH);
modePanel.add(new JScrollPane(modeTable), BorderLayout.CENTER);
noticeText = new JTextArea("");
noticeText.setOpaque(false);
noticeText.setEditable(false);
noticeText.setLineWrap(true);
noticeText.setWrapStyleWord(true);
JScrollPane noticePane = new JScrollPane(noticeText);
noticePane.setBorder(new TitledBorder(new EtchedBorder(), "Notice"));
noticePane.setMinimumSize(new Dimension(200, 120));
JSplitPane rightPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
rightPanel.setBorder(new EmptyBorder(0, 0, 0, 0));
rightPanel.setDividerSize(4);
rightPanel.setResizeWeight(1.0);
rightPanel.setLeftComponent(modePanel);
rightPanel.setRightComponent(noticePane);
JSplitPane mainPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
mainPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
mainPanel.setDividerSize(4);
mainPanel.setResizeWeight(1.0);
mainPanel.setLeftComponent(leftPanel);
mainPanel.setRightComponent(rightPanel);
add(mainPanel);
}