本文整理了Java中javax.swing.JPanel.setPreferredSize()
方法的一些代码示例,展示了JPanel.setPreferredSize()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JPanel.setPreferredSize()
方法的具体详情如下:
包路径:javax.swing.JPanel
类名称:JPanel
方法名:setPreferredSize
暂无
代码示例来源:origin: ballerina-platform/ballerina-lang
public BallerinaModuleSettingsUI(@NotNull Module module, boolean dialogMode) {
myPanel.setPreferredSize(new Dimension(400, -1));
}
代码示例来源:origin: stackoverflow.com
JFrame frame = new JFrame();
frame.setLayout(new BorderLayout());
frame.setSize(200, 200);
// create the status bar panel and shove it down the bottom of the frame
JPanel statusPanel = new JPanel();
statusPanel.setBorder(new BevelBorder(BevelBorder.LOWERED));
frame.add(statusPanel, BorderLayout.SOUTH);
statusPanel.setPreferredSize(new Dimension(frame.getWidth(), 16));
statusPanel.setLayout(new BoxLayout(statusPanel, BoxLayout.X_AXIS));
JLabel statusLabel = new JLabel("status");
statusLabel.setHorizontalAlignment(SwingConstants.LEFT);
statusPanel.add(statusLabel);
frame.setVisible(true);
代码示例来源:origin: 4thline/cling
@PostConstruct
public void init() {
browserPanel.add(browserView.asUIComponent(), BorderLayout.CENTER);
browserPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 0, 5));
browserPanel.setPreferredSize(new Dimension(250, 250));
browserPanel.setMinimumSize(new Dimension(250, 250));
infoPanel.add(deviceInfosView.asUIComponent(), BorderLayout.CENTER);
infoPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 10));
infoPanel.setPreferredSize(new Dimension(675, 200));
infoPanel.setMinimumSize(new Dimension(650, 200));
eastWestSplitPane.setBorder(BorderFactory.createEmptyBorder());
eastWestSplitPane.setResizeWeight(0);
eastWestSplitPane.setLeftComponent(browserPanel);
eastWestSplitPane.setRightComponent(infoPanel);
northSouthSplitPane.setBorder(BorderFactory.createEmptyBorder());
northSouthSplitPane.setResizeWeight(0.8);
northSouthSplitPane.setTopComponent(eastWestSplitPane);
northSouthSplitPane.setBottomComponent(logView.asUIComponent());
add(toolbarView.asUIComponent(), BorderLayout.NORTH);
add(northSouthSplitPane, BorderLayout.CENTER);
setSize(new Dimension(975, 700));
setMinimumSize(new Dimension(975, 450));
setResizable(true);
}
代码示例来源:origin: fossasia/neurolab-desktop
this.setSize(new Dimension(frameWidth, frameHeight));
softeningSlider.setPreferredSize(new Dimension(200, 30));
this.trackPanelGraphics = this.trackPanel.getGraphics();
this.toolsPanel = new JPanel();
this.toolsPanel.setBackground(Color.darkGray);
this.toolsPanel.setLayout(new GridLayout(1, 3));
JPanel feedbackSettingsPanel = new JPanel();
feedbackSettingsPanel.setBorder(BorderFactory.createTitledBorder("feedback: " ));
JPanel sliderPanel = new JPanel();
sliderPanel.setLayout(new BoxLayout(sliderPanel, BoxLayout.X_AXIS));
sliderPanel.add(sliderMin);
sliderPanel.add(sliderMax);
sliderPanel.setPreferredSize(new Dimension(60, 600));
sliderMin.setPreferredSize(new Dimension(30, 600));
sliderMax.setPreferredSize(new Dimension(30, 600));
displaySettingsPanel.add(sliderPanel, BorderLayout.CENTER);
JPanel softeningPanel = new JPanel();
softeningPanel.setLayout(new BoxLayout(softeningPanel, BoxLayout.Y_AXIS));
代码示例来源:origin: stackoverflow.com
JFrame jf = new JFrame();
JPanel jp = new JPanel();
jp.setPreferredSize(new Dimension(400,800));// changed it to preferredSize, Thanks!
jf.getContentPane().add( jp );// adding to content pane will work here. Please read the comment bellow.
jf.pack();
代码示例来源:origin: graphhopper/graphhopper
int frameWidth = 1200;
JFrame frame = new JFrame("GraphHopper UI - Small&Ugly ;)");
frame.setLayout(new BorderLayout());
frame.add(mainPanel, BorderLayout.CENTER);
frame.add(infoPanel, BorderLayout.NORTH);
infoPanel.setPreferredSize(new Dimension(300, 100));
代码示例来源:origin: dboissier/mongo4idea
private AddKeyDialog(MongoEditionPanel mongoEditionPanel) {
super(mongoEditionPanel);
mainPanel.setPreferredSize(GuiUtils.enlargeWidth(mainPanel.getPreferredSize(), 1.5d));
valuePanel.setLayout(new BorderLayout());
nameTextfield.setName("keyName");
typeCombobox.setName("valueType");
}
代码示例来源:origin: go-lang-plugin-org/go-lang-idea-plugin
@Nullable
@Override
protected JComponent createCenterPanel() {
JPanel panel = new JPanel(new BorderLayout());
panel.add(createNamePanel(), BorderLayout.CENTER);
if (myOccurrencesCount > 1) panel.add(createReplaceAllPanel(), BorderLayout.SOUTH);
panel.setPreferredSize(new Dimension(myNameField.getWidth(), -1));
return panel;
}
代码示例来源:origin: apache/pdfbox
@Override
public JPanel getPanel()
{
if (view != null)
{
return view.getPanel();
}
JPanel panel = new JPanel();
panel.setPreferredSize(new Dimension(300, 500));
return panel;
}
}
代码示例来源:origin: go-lang-plugin-org/go-lang-idea-plugin
public GoModuleSettingsUI(@NotNull Module module, boolean dialogMode) {
if (dialogMode) {
myPanel.setPreferredSize(new Dimension(400, -1));
}
myVendoringUI.initPanel(module);
myBuildTagsUI.initPanel(module);
}
代码示例来源:origin: 4thline/cling
statusIconButton.setFocusable(false);
statusIconPanel.setPreferredSize(new Dimension(150, 200));
statusIconPanel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 10));
statusIconPanel.add(statusIconButton);
statusIconPanel.add(fullscreenCheckbox);
getLogPanel().setPreferredSize(new Dimension(800, 175));
getView().setMinimumSize(new Dimension(150, 200));
getView().add(statusIconPanel, BorderLayout.WEST);
getView().add(getLogPanel(), BorderLayout.CENTER);
代码示例来源:origin: stanfordnlp/CoreNLP
content.setLayout(new BorderLayout());
JSplitPane verticalSplit = new JSplitPane(JSplitPane.VERTICAL_SPLIT, inputAndMatchesPanel, displayMatchesPanel);
verticalSplit.setResizeWeight(.2);
if (screenSize.height > 800) { screenSize.height = 800; }
setPreferredSize(screenSize);
Dimension displayMatchesSize = new Dimension((int) (screenSize.getWidth()),(int) (screenSize.getHeight()*3/4.));
displayMatchesPanel.setPreferredSize(displayMatchesSize);
代码示例来源:origin: libgdx/libgdx
JPanel panel = new JPanel();
panel.add(new JLabel("Global"), new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE,
new Insets(0, 0, 0, 0), 0, 0));
panel.add(isGlobalCheckBox = new JCheckBox(), new GridBagConstraints(1, 0, 1, 1, 0, 0,
GridBagConstraints.WEST, GridBagConstraints.NONE,
new Insets(0, 0, 0, 0), 0, 0));
contentPanel.add(panel,new GridBagConstraints(0, 1, 1, 1, 0, 0,
GridBagConstraints.WEST, GridBagConstraints.NONE,
new Insets(0, 0, 0, 0), 0, 0));
JPanel spacer = new JPanel();
spacer.setPreferredSize(new Dimension());
contentPanel.add(spacer, new GridBagConstraints(6, 0, 1, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.NONE,
new Insets(0, 0, 0, 0), 0, 0));
代码示例来源:origin: stackoverflow.com
JPanel test = new JPanel();
test.setPreferredSize(new Dimension( 2000,2000));
JScrollPane scrollFrame = new JScrollPane(test);
test.setAutoscrolls(true);
scrollFrame.setPreferredSize(new Dimension( 800,300));
this.add(scrollFrame);
代码示例来源:origin: runelite/runelite
private void contract()
{
if (pluginPanel == null)
{
return;
}
pluginPanel.onDeactivate();
navContainer.setMinimumSize(new Dimension(0, 0));
navContainer.setMaximumSize(new Dimension(0, 0));
navContainer.setPreferredSize(new Dimension(0, 0));
navContainer.revalidate();
giveClientFocus();
frame.contractBy(pluginPanel.getWrappedPanel().getPreferredSize().width);
pluginPanel = null;
}
代码示例来源:origin: libgdx/libgdx
JPanel panel = new JPanel();
panel.add(new JLabel("Global"), new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE,
new Insets(0, 0, 0, 0), 0, 0));
panel.add(isGlobalCheckBox = new JCheckBox(), new GridBagConstraints(1, 0, 1, 1, 0, 0,
GridBagConstraints.WEST, GridBagConstraints.NONE,
new Insets(0, 0, 0, 0), 0, 0));
contentPanel.add(panel,new GridBagConstraints(0, 1, 1, 1, 0, 0,
GridBagConstraints.WEST, GridBagConstraints.NONE,
new Insets(0, 0, 0, 0), 0, 0));
JPanel spacer = new JPanel();
spacer.setPreferredSize(new Dimension());
contentPanel.add(spacer, new GridBagConstraints(6, 0, 1, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.NONE,
new Insets(0, 0, 0, 0), 0, 0));
代码示例来源:origin: log4j/log4j
final JScrollPane scrollPane = new JScrollPane(table);
scrollPane.setBorder(BorderFactory.createTitledBorder("Events: "));
scrollPane.setPreferredSize(new Dimension(900, 300));
details.setPreferredSize(new Dimension(900, 300));
代码示例来源:origin: libgdx/libgdx
contentPanel.add(label, new GridBagConstraints(0, 1, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE,
new Insets(0, 0, 0, 6), 0, 0));
contentPanel.add(shapeCombo, new GridBagConstraints(1, 1, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE,
new Insets(0, 0, 0, 0), 0, 0));
contentPanel.add(edgesLabel, new GridBagConstraints(2, 1, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE,
new Insets(0, 12, 0, 6), 0, 0));
JPanel spacer = new JPanel();
spacer.setPreferredSize(new Dimension());
contentPanel.add(spacer, new GridBagConstraints(6, 0, 1, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.NONE,
new Insets(0, 0, 0, 0), 0, 0));
代码示例来源:origin: go-lang-plugin-org/go-lang-idea-plugin
public GoSdkConfigurable(@NotNull Project project, boolean dialogMode) {
myProject = project;
if (dialogMode) {
myComponent.setPreferredSize(new Dimension(400, -1));
}
FileChooserDescriptor chooserDescriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor().withTitle("Select GOROOT");
mySdkPathField.addBrowseFolderListener(myProject, new MyBrowseFolderListener(chooserDescriptor));
listenForPathUpdate();
Disposer.register(myDisposable, mySdkPathField);
}
代码示例来源:origin: libgdx/libgdx
contentPanel.add(label, new GridBagConstraints(0, 1, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE,
new Insets(0, 0, 0, 6), 0, 0));
contentPanel.add(shapeCombo, new GridBagConstraints(1, 1, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE,
new Insets(0, 0, 0, 0), 0, 0));
contentPanel.add(edgesLabel, new GridBagConstraints(2, 1, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE,
new Insets(0, 12, 0, 6), 0, 0));
JPanel spacer = new JPanel();
spacer.setPreferredSize(new Dimension());
contentPanel.add(spacer, new GridBagConstraints(6, 0, 1, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.NONE,
new Insets(0, 0, 0, 0), 0, 0));
内容来源于网络,如有侵权,请联系作者删除!