本文整理汇总了Java中javax.swing.JPanel.setMinimumSize方法的典型用法代码示例。如果您正苦于以下问题:Java JPanel.setMinimumSize方法的具体用法?Java JPanel.setMinimumSize怎么用?Java JPanel.setMinimumSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JPanel
的用法示例。
在下文中一共展示了JPanel.setMinimumSize方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: TurnAnalyzer
import javax.swing.JPanel; //导入方法依赖的package包/类
@SuppressWarnings("serial")
public TurnAnalyzer(JFrame frame) {
super(frame,"Turn analysis");
menuPainter = new JPanel() {
public void paint(Graphics g) {
if (refImg == null) {
return;
}
Graphics2D g2 = (Graphics2D) g;
g2.scale(2, 2);
g2.drawImage(refImg, 0, 0, null);
}
};
menuPainter.setPreferredSize(MENU_SIZE_X2);
menuPainter.setMinimumSize(MENU_SIZE_X2);
menuPainter.setSize(MENU_SIZE_X2);
initialize();
}
示例2: getSplitter
import javax.swing.JPanel; //导入方法依赖的package包/类
private JPanel getSplitter(int widht, int height) {
JPanel splitPane = new JPanel();
Dimension dim = new Dimension(widht, height);
splitPane.setEnabled(false);
splitPane.setPreferredSize(dim);
splitPane.setMaximumSize(dim);
splitPane.setMinimumSize(dim);
return splitPane;
}
示例3: addCluster
import javax.swing.JPanel; //导入方法依赖的package包/类
public void addCluster(ClusterDiagram newCluster) {
totalNumberOfCluster+=1;
totalNCluster.setText(String.valueOf(totalNumberOfCluster));
ClusterDiagram copy = new ClusterDiagram(newCluster);
boolean fBonds = true;
boolean eBonds = false;
if (fDrawBondsCB.isEnabled()) {
fBonds = fDrawBondsCB.getState();
eBonds = eDrawBondsCB.getState();
}
ClusterPanel cp = new ClusterPanel(copy, drawPoints, drawNumbersWhite, drawNumbersBlack, fBonds, eBonds);
//cp.addMouseListener(new MouseEventClusterPanel());
Dimension d = new Dimension();
d.width=100;
d.height=100;
cp.setSize(d);
JPanel jp = new JPanel(new java.awt.GridLayout(1,1));
cp.addMouseListener(new MouseEventClusterPanel());
jp.setPreferredSize(d);
jp.setMinimumSize(d);
jp.add(cp);
jp.setBackground(null);
graphicOut2.add(jp);
myPanel.updateUI();
}
示例4: createConfigPanel
import javax.swing.JPanel; //导入方法依赖的package包/类
protected void createConfigPanel(JPanel p) {
configPanel = new JPanel(new GridLayout(0,1));
configPanel.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));
configPanel.add(p);
//JOC : Set a min size width to keep combo boxs under control
configPanel.setMinimumSize(new Dimension(110, configPanel.getMinimumSize().height));
configPanel.setPreferredSize(new Dimension(160, configPanel.getPreferredSize().height));
}
示例5: getToolbarPresenter
import javax.swing.JPanel; //导入方法依赖的package包/类
@Override
public Component getToolbarPresenter() {
// Do not return combo box directly; looks bad.
JPanel toolbarPanel = new JPanel(new GridBagLayout());
toolbarPanel.setOpaque(false); // don't interrupt JToolBar background
toolbarPanel.setMaximumSize(new Dimension(150, 80));
toolbarPanel.setMinimumSize(new Dimension(150, 0));
toolbarPanel.setPreferredSize(new Dimension(150, 23));
initConfigListCombo();
// XXX top inset of 2 looks better w/ small toolbar, but 1 seems to look better for large toolbar (the default):
toolbarPanel.add(configListCombo, new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(1, 6, 1, 5), 0, 0));
return toolbarPanel;
}
示例6: createSeparator
import javax.swing.JPanel; //导入方法依赖的package包/类
private JPanel createSeparator() {
JPanel panel = new JPanel();
panel.setBackground(javax.swing.UIManager.getDefaults().getColor("Separator.foreground"));
panel.setMaximumSize(new java.awt.Dimension(32767, 1));
panel.setMinimumSize(new java.awt.Dimension(10, 1));
panel.setPreferredSize(new java.awt.Dimension(0, 1));
return panel;
}
示例7: makeBottomPanel
import javax.swing.JPanel; //导入方法依赖的package包/类
protected Component makeBottomPanel() {
JPanel panel = new JPanel(new FlowLayout(0));
panel.setMinimumSize(new Dimension(100, 35));
panel.setPreferredSize(new Dimension(100, 35));
panel.setBorder(BorderFactory.createMatteBorder(1, 0, 0, 0, Color.LIGHT_GRAY));
return panel;
}
示例8: buildMainPanel
import javax.swing.JPanel; //导入方法依赖的package包/类
protected Component buildMainPanel() {
JPanel keyPanel = buildKeyTablePanel();
/*
* Tree of all components from target component down
*/
JPanel treePanel = new JPanel(new BorderLayout());
MyTreeNode top = new MyTreeNode(target);
createNodes(top);
tree = new JTree(top);
tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
tree.addTreeSelectionListener(this);
tree.setSelectionRow(0);
tree.setCellRenderer(new MyTreeCellRenderer());
JScrollPane treeScroll = new JScrollPane(tree, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
treePanel.add(treeScroll, BorderLayout.CENTER);
treePanel.setMinimumSize(new Dimension(400, 100));
treePanel.setPreferredSize(new Dimension(800, 300));
/*
* First split between Tree display and Keys
*/
JSplitPane split1 = new JSplitPane(JSplitPane.VERTICAL_SPLIT, treePanel, keyPanel);
split1.setResizeWeight(0.5);
return split1;
}
示例9: buildCochleaChannelsLRTab
import javax.swing.JPanel; //导入方法依赖的package包/类
private JPanel buildCochleaChannelsLRTab(String lTitle, List<CochleaChannelConfig> lChannels, String rTitle, List<CochleaChannelConfig> rChannels) {
JPanel channelPanel = new JPanel();
channelPanel.setLayout(new BoxLayout(channelPanel, BoxLayout.X_AXIS));
channelPanel.add(buildCochleaChannelsGroup(lTitle, lChannels));
channelPanel.add(buildCochleaChannelsGroup(rTitle, rChannels));
channelPanel.setMinimumSize(channelPanel.getLayout().minimumLayoutSize(channelPanel));
return channelPanel;
}
示例10: initTools
import javax.swing.JPanel; //导入方法依赖的package包/类
void initTools() {
tools = new JPanel(new BorderLayout());
tools.setMinimumSize(new Dimension(200, tools.getMinimumSize().height));
tools.setPreferredSize(new Dimension(200, tools.getPreferredSize().height));
JPanel panel = new JPanel(new GridLayout(0,1));
helpBtn = new JButton("Help");
helpBtn.addActionListener(this);
panel.add(helpBtn);
startStopBtn = new JToggleButton("Start digitizing");
startStopBtn.addActionListener(this);
startStopBtn.setForeground(new Color(0,128,0));
panel.add(startStopBtn);
deleteBtn = new JButton("Delete segment(s)");
deleteBtn.addActionListener(this);
panel.add(deleteBtn);
addBtn = new JButton("Add to segment");
addBtn.addActionListener(this);
addBtn.setEnabled(false);
panel.add(addBtn);
objectClasses = new Class[2];
objectClasses[0] = null;
tools.add( panel, "North" );
tools.add( new JScrollPane( list ), "Center");
try {
objectClasses[1] = Class.forName( "haxby.db.dig.LineSegmentsObject" );
} catch( Exception ex) {
ex.printStackTrace();
objectClasses[1] = null;
}
}
示例11: createImportFailedPane
import javax.swing.JPanel; //导入方法依赖的package包/类
private JComponent createImportFailedPane( Exception cause ) {
JLabel infoLabel = new JLabel( NbBundle.getMessage( ProgressTrackingPanel.class, "ProgressTrackingPanel.importFailedMessage" ));
infoLabel.setHorizontalAlignment(JLabel.CENTER );
infoLabel.setBackground(Color.red);
infoLabel.setOpaque(true);
infoLabel.setBorder( BorderFactory.createLineBorder(Color.red, 3) );
ByteArrayOutputStream arrayOutputStream = new ByteArrayOutputStream();
PrintWriter printWriter = new PrintWriter( arrayOutputStream );
cause.printStackTrace( printWriter );
printWriter.flush();
String stackTraceText = arrayOutputStream.toString();
JTextArea stackTraceTextArea = new JTextArea( stackTraceText );
stackTraceTextArea.setEditable(false);
JScrollPane scrollPane = new JScrollPane( stackTraceTextArea );
JButton copyToClipboardButton = new JButton( NbBundle.getMessage( ProgressTrackingPanel.class, "ProgressTrackingPanel.copyToClipboard" ));
copyToClipboardButton.addActionListener( (a) -> {
Toolkit defaultToolkit = Toolkit.getDefaultToolkit();
defaultToolkit.getSystemClipboard().setContents( new StringSelection(stackTraceText), null );
});
JPanel p1 = new JPanel( new FlowLayout(FlowLayout.TRAILING) );
p1.add( copyToClipboardButton );
JPanel p2 = new JPanel( new BorderLayout(0, 10) );
p2.add( infoLabel, BorderLayout.NORTH );
p2.add( scrollPane, BorderLayout.CENTER );
p2.add( p1, BorderLayout.SOUTH );
p2.setSize( new Dimension(600,400) );
p2.setMinimumSize( p2.getSize() );
p2.setPreferredSize( p2.getSize() );
return p2;
}
示例12: initUI
import javax.swing.JPanel; //导入方法依赖的package包/类
private void initUI() {
categoriesModel = new CategoriesListModel();
categoriesSelection = new CategoriesSelectionModel();
scrollIncrement = new JCheckBox("XXX").getPreferredSize().height; // NOI18N
JList<ProfilerOptionsPanel> categoriesList = new JList(categoriesModel) {
public Dimension getPreferredSize() {
Dimension dim = super.getPreferredSize();
dim.width = Math.max(dim.width + 20, 140);
return dim;
}
};
categoriesList.setVisibleRowCount(0);
categoriesList.setSelectionModel(categoriesSelection);
categoriesList.setCellRenderer(new DefaultListCellRenderer() {
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
String panelName = " " + ((ProfilerOptionsPanel)value).getDisplayName() + " "; // NOI18N
return super.getListCellRendererComponent(list, panelName, index, isSelected, cellHasFocus);
}
});
JScrollPane categoriesScroll = new JScrollPane(categoriesList);
JLabel categoriesLabel = new JLabel();
categoriesLabel.setHorizontalAlignment(JLabel.LEADING);
Mnemonics.setLocalizedText(categoriesLabel, Bundle.ProfilerOptionsContainer_Categories());
categoriesLabel.setLabelFor(categoriesList);
int labelOffset = 6;
JPanel categoriesPanel = new JPanel(new BorderLayout(0, labelOffset));
categoriesPanel.add(categoriesLabel, BorderLayout.NORTH);
categoriesPanel.add(categoriesScroll, BorderLayout.CENTER);
content = new JPanel(new BorderLayout());
content.setBorder(BorderFactory.createEmptyBorder(categoriesLabel.getPreferredSize().height + labelOffset, 11, 0, 0));
content.setMinimumSize(new Dimension(0, 0));
content.setPreferredSize(new Dimension(0, 0));
setLayout(new BorderLayout());
add(categoriesPanel, BorderLayout.WEST);
add(content, BorderLayout.CENTER);
}
示例13: initGUI
import javax.swing.JPanel; //导入方法依赖的package包/类
/**
* 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());
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);
}
示例14: initComponents
import javax.swing.JPanel; //导入方法依赖的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);
}
示例15: initComponents
import javax.swing.JPanel; //导入方法依赖的package包/类
private void initComponents() {
setLayout(new BorderLayout());
String modeName = stationData.getTransitionModeName(stationKey, 0);
enablingBorder = new TitledBorder(new EtchedBorder(), "Enabling Condition for " + modeName);
enablingTable = new ConditionTable(true);
enablingPane = new JScrollPane(enablingTable);
enablingPane.setBorder(enablingBorder);
enablingPane.setMinimumSize(new Dimension(300, 120));
inhibitingBorder = new TitledBorder(new EtchedBorder(), "Inhibiting Condition for " + modeName);
inhibitingTable = new ConditionTable(false);
inhibitingPane = new JScrollPane(inhibitingTable);
inhibitingPane.setBorder(inhibitingBorder);
inhibitingPane.setMinimumSize(new Dimension(300, 120));
JPanel conditionPanel = new JPanel(new GridLayout(2, 1, 3, 3));
conditionPanel.add(enablingPane);
conditionPanel.add(inhibitingPane);
leftPanel = new WarningScrollTable(conditionPanel, WARNING_CLASS_INCOMING_ROUTING);
leftPanel.addCheckVector(stationInKeys);
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);
}