本文整理了Java中javax.swing.BoxLayout
类的一些代码示例,展示了BoxLayout
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。BoxLayout
类的具体详情如下:
包路径:javax.swing.BoxLayout
类名称:BoxLayout
暂无
代码示例来源:origin: stackoverflow.com
JLabel l = new JLabel(text, alignment);
l.setBorder(new LineBorder(Color.RED, 2));
return l;
SwingUtilities.invokeLater(new Runnable() {
public void run() {
JPanel p = new JPanel(new GridLayout(2,2,4,4));
p.setBackground(Color.black);
p.setBorder(new EmptyBorder(4,4,4,4));
JPanel border = new JPanel(new BorderLayout());
border.add(getLabel(
"Border", SwingConstants.CENTER), BorderLayout.CENTER);
p.add(border);
JPanel gridbag = new JPanel(new GridBagLayout());
gridbag.add(getLabel("GridBag"));
p.add(gridbag);
JPanel box = new JPanel();
box.setLayout(new BoxLayout(box, BoxLayout.X_AXIS ));
box.add(Box.createHorizontalGlue());
代码示例来源:origin: skylot/jadx
@NotNull
protected JPanel initButtonsPanel() {
progressPane = new ProgressPanel(mainWindow, false);
JButton cancelButton = new JButton(NLS.str("search_dialog.cancel"));
cancelButton.addActionListener(event -> dispose());
JButton openBtn = new JButton(NLS.str("search_dialog.open"));
openBtn.addActionListener(event -> openSelectedItem());
getRootPane().setDefaultButton(openBtn);
JPanel buttonPane = new JPanel();
buttonPane.setLayout(new BoxLayout(buttonPane, BoxLayout.LINE_AXIS));
buttonPane.setBorder(BorderFactory.createEmptyBorder(0, 10, 10, 10));
buttonPane.add(progressPane);
buttonPane.add(Box.createRigidArea(new Dimension(5, 0)));
buttonPane.add(Box.createHorizontalGlue());
buttonPane.add(openBtn);
buttonPane.add(Box.createRigidArea(new Dimension(10, 0)));
buttonPane.add(cancelButton);
return buttonPane;
}
代码示例来源:origin: stanfordnlp/CoreNLP
topPanel = new javax.swing.JPanel();
buttonsAndFilePanel = new javax.swing.JPanel();
loadButtonPanel = new javax.swing.JPanel();
loadFileButton = new javax.swing.JButton();
loadParserButton = new javax.swing.JButton();
saveOutputButton = new javax.swing.JButton();
dataFileLabel = new javax.swing.JLabel();
textScrollPane = new javax.swing.JScrollPane();
parserFileLabel = new javax.swing.JLabel();
statusPanel = new javax.swing.JPanel();
statusLabel = new javax.swing.JLabel();
progressBar = new javax.swing.JProgressBar();
progressBar.setVisible(false);
buttonsAndFilePanel.setLayout(new javax.swing.BoxLayout(buttonsAndFilePanel, javax.swing.BoxLayout.Y_AXIS));
textPane.setPreferredSize(new java.awt.Dimension(250, 250));
textPane.addFocusListener(new java.awt.event.FocusAdapter() {
@Override
textScrollPane.setViewportView(textPane);
treeContainer.setPreferredSize(new java.awt.Dimension(200, 200));
代码示例来源:origin: stanfordnlp/CoreNLP
private void doEncodingPrompt(final String encoding, final String oldEncoding) {
final JPanel encodingPanel = new JPanel();
encodingPanel.setLayout(new BoxLayout(encodingPanel, BoxLayout.PAGE_AXIS));
JLabel text = new JLabel("<html>A head finder or tree reader was selected that has the default encoding " + encoding
+ "; this differs from " + oldEncoding + ", which was being used. If the encoding is changed, all newly loaded" +
"treebanks will be read using the new encoding. Choosing an encoding that is not the true encoding of your tree " +
"files may cause errors and unexpected behavior.</html>");
text.setAlignmentX(SwingConstants.LEADING);
JPanel textPanel = new JPanel(new BorderLayout());
textPanel.setPreferredSize(new Dimension(100,100));
textPanel.add(text);
encodingPanel.add(textPanel);
fileFilterDialog.setMessage(encodingPanel);
JButton[] options = new JButton[3];
JButton useNewEncoding = new JButton("Use " + encoding);
JButton useOldEncoding = new JButton("Use " + oldEncoding);
JButton useAnotherEncoding = new JButton("Use encoding...");
代码示例来源:origin: skylot/jadx
public final void initUI() {
Font font = new Font("Serif", Font.BOLD, 13);
JLabel name = new JLabel("jadx");
name.setFont(font);
name.setAlignmentX(0.5f);
JLabel desc = new JLabel("Dex to Java decompiler");
version.setAlignmentX(0.5f);
JPanel textPane = new JPanel();
textPane.setBorder(BorderFactory.createEmptyBorder(15, 15, 15, 15));
textPane.setLayout(new BoxLayout(textPane, BoxLayout.PAGE_AXIS));
textPane.add(Box.createRigidArea(new Dimension(0, 10)));
textPane.add(name);
textPane.add(Box.createRigidArea(new Dimension(0, 10)));
textPane.add(desc);
textPane.add(Box.createRigidArea(new Dimension(0, 10)));
textPane.add(version);
textPane.add(Box.createRigidArea(new Dimension(0, 20)));
JButton close = new JButton(NLS.str("tabs.close"));
close.addActionListener(event -> dispose());
close.setAlignmentX(0.5f);
contentPane.add(textPane, BorderLayout.CENTER);
contentPane.add(close, BorderLayout.PAGE_END);
代码示例来源:origin: stanfordnlp/CoreNLP
jPanel1.setLayout(new javax.swing.BoxLayout(jPanel1, javax.swing.BoxLayout.Y_AXIS));
jLabel2.setText("Type in the internet address of a document or web page.");
jPanel1.add(jLabel2);
jPanel3.add(jLabel1);
urlTextField.setMinimumSize(new java.awt.Dimension(100, 20));
urlTextField.setPreferredSize(new java.awt.Dimension(300, 20));
urlTextField.getDocument().addDocumentListener(new DocumentListener() {
public void changedUpdate(DocumentEvent e) {
jPanel1.add(jPanel3);
getContentPane().add(jPanel1, java.awt.BorderLayout.NORTH);
openButton.setText("Open");
jPanel2.add(browseButton);
getContentPane().add(jPanel2, java.awt.BorderLayout.SOUTH);
代码示例来源:origin: marytts/marytts
.addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
spLanguages.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
pLanguages.setLayout(new javax.swing.BoxLayout(pLanguages, javax.swing.BoxLayout.Y_AXIS));
spLanguages.setViewportView(pLanguages);
spVoices.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
pVoices.setLayout(new javax.swing.BoxLayout(pVoices, javax.swing.BoxLayout.Y_AXIS));
spVoices.setViewportView(pVoices);
jLabel1.setText("Languages");
jLabel2.setText("Voices");
getContentPane().setLayout(layout);
layout.setHorizontalGroup(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(
org.jdesktop.layout.GroupLayout.TRAILING,
代码示例来源:origin: libgdx/libgdx
JPanel panel = new JPanel();
panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
for (String subIncompat : incompatList) {
JLabel label = new JLabel(subIncompat);
label.setAlignmentX(Component.CENTER_ALIGNMENT);
panel.add(label);
JLabel infoLabel = new JLabel("<html><br><br>The project can be generated, but you wont be able to use these extensions in the respective sub modules<br>Please see the link to learn about extensions</html>");
infoLabel.setAlignmentX(Component.CENTER_ALIGNMENT);
panel.add(infoLabel);
代码示例来源:origin: ballerina-platform/ballerina-lang
public ServersGUI() {
rootPanel = new JPanel();
rootPanel.setLayout(new BoxLayout(rootPanel, BoxLayout.Y_AXIS));
rootPanel.add(createArtifactRow("", "", "", ""));
}
代码示例来源:origin: magefree/mage
labelSource = new javax.swing.JLabel();
buttonSearchSet = new javax.swing.JButton();
buttonOK = new javax.swing.JButton();
getContentPane().setLayout(new java.awt.BorderLayout());
panelGlobal.setLayout(new javax.swing.BoxLayout(panelGlobal, javax.swing.BoxLayout.Y_AXIS));
getContentPane().add(panelGlobal, java.awt.BorderLayout.NORTH);
tabMain.setLayout(new javax.swing.BoxLayout(tabMain, javax.swing.BoxLayout.Y_AXIS));
panelInfo.setLayout(new javax.swing.BoxLayout(panelInfo, javax.swing.BoxLayout.Y_AXIS));
panelSource.setLayout(new javax.swing.BoxLayout(panelSource, javax.swing.BoxLayout.X_AXIS));
panelMode.setLayout(new javax.swing.BoxLayout(panelMode, javax.swing.BoxLayout.LINE_AXIS));
panelModeSelect.setLayout(new javax.swing.BoxLayout(panelModeSelect, javax.swing.BoxLayout.X_AXIS));
panelProgress.setLayout(new javax.swing.BoxLayout(panelProgress, javax.swing.BoxLayout.X_AXIS));
tabCustom.setLayout(new javax.swing.BoxLayout(tabCustom, javax.swing.BoxLayout.Y_AXIS));
tabsList.addTab("Custom download", new javax.swing.ImageIcon(getClass().getResource("/buttons/list_panel.png")), tabCustom); // NOI18N
getContentPane().add(tabsList, java.awt.BorderLayout.CENTER);
代码示例来源:origin: redwarp/9-Patch-Resizer
private JPanel createInputPanel() {
JPanel inputPanel = new JPanel();
inputPanel.setPreferredSize(new Dimension(10, 140));
new JButton(String.format(Locale.getDefault(), Localization.get("xhdpi"),
Configuration.getSettings().getDefaultInputDensity().getName()));
this.xhdpiButton.addActionListener(new ActionListener() {
JPanel optionPanel = new JPanel();
optionPanel.setLayout(new BoxLayout(optionPanel, BoxLayout.PAGE_AXIS));
optionPanel.add(Box.createVerticalGlue());
JLabel inputLabel = new JLabel(Localization.get("input_density"));
inputLabel.setAlignmentX(Component.LEFT_ALIGNMENT);
optionPanel.add(inputLabel);
inputDensityChoice = new JComboBox<ScreenDensity>(
代码示例来源:origin: skylot/jadx
warnLabel = new JLabel();
warnLabel.setForeground(Color.RED);
warnLabel.setVisible(false);
JPanel resultsPanel = new JPanel();
resultsPanel.setLayout(new BoxLayout(resultsPanel, BoxLayout.PAGE_AXIS));
resultsPanel.add(warnLabel);
resultsPanel.add(new JScrollPane(resultsTable,
ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED));
JPanel paginationPanel = new JPanel();
paginationPanel.setAlignmentX(Component.LEFT_ALIGNMENT);
paginationPanel.setLayout(new BoxLayout(paginationPanel, BoxLayout.X_AXIS));
resultsInfoLabel = new JLabel("");
JButton nextPageButton = new JButton("->");
nextPageButton.setToolTipText(NLS.str("search_dialog.next_page"));
nextPageButton.addActionListener(e -> {
if (resultsModel.nextPage()) {
switchPage(renderer);
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
pnlButtons = new javax.swing.JPanel();
sldVolume = new javax.swing.JSlider();
btnRewind = new javax.swing.JButton();
btnStop = new javax.swing.JButton();
btnPlay = new javax.swing.JButton();
btnFF = new javax.swing.JButton();
btnOpen = new javax.swing.JButton();
pnlBar = new javax.swing.JPanel();
lblTime = new javax.swing.JLabel();
sldBar = new javax.swing.JSlider();
pnlButtons.setLayout(new javax.swing.BoxLayout(pnlButtons, javax.swing.BoxLayout.LINE_AXIS));
pnlButtons.add(btnOpen);
getContentPane().add(pnlButtons, java.awt.BorderLayout.CENTER);
pnlBar.setLayout(new javax.swing.BoxLayout(pnlBar, javax.swing.BoxLayout.LINE_AXIS));
lblTime.setText("0:00-0:00");
lblTime.setBorder(javax.swing.BorderFactory.createEmptyBorder(3, 3, 3, 3));
pnlBar.add(lblTime);
pnlBar.add(sldBar);
getContentPane().add(pnlBar, java.awt.BorderLayout.PAGE_START);
代码示例来源:origin: geotools/geotools
JButton cancelButton = new JButton("Cancel");
cancelButton.addActionListener(this);
final JButton setButton = new JButton("Select");
setButton.setActionCommand("Select");
setButton.addActionListener(this);
JScrollPane listScroller = new JScrollPane(list);
listScroller.setPreferredSize(new Dimension(400, 280));
JPanel listPane = new JPanel();
listPane.setLayout(new BoxLayout(listPane, BoxLayout.PAGE_AXIS));
JLabel label = new JLabel("Layers");
label.setLabelFor(list);
listPane.add(label);
listPane.add(Box.createRigidArea(new Dimension(0, 5)));
listPane.add(listScroller);
listPane.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
JPanel buttonPane = new JPanel();
buttonPane.setLayout(new BoxLayout(buttonPane, BoxLayout.LINE_AXIS));
buttonPane.setBorder(BorderFactory.createEmptyBorder(0, 10, 10, 10));
buttonPane.add(Box.createHorizontalGlue());
buttonPane.add(cancelButton);
buttonPane.add(Box.createRigidArea(new Dimension(10, 0)));
buttonPane.add(setButton);
contentPane.add(listPane, BorderLayout.CENTER);
contentPane.add(buttonPane, BorderLayout.PAGE_END);
代码示例来源:origin: magefree/mage
jButton2 = new javax.swing.JButton();
jLabel1 = new javax.swing.JLabel();
lblLandSet = new javax.swing.JLabel();
lblForest = new javax.swing.JLabel();
spnForest = new javax.swing.JSpinner();
lblForestIcon = new javax.swing.JLabel();
lblForestIcon.setToolTipText("");
lblForestIcon.setMaximumSize(new java.awt.Dimension(22, 20));
lblForestIcon.setMinimumSize(new java.awt.Dimension(22, 20));
lblForestIcon.setPreferredSize(new java.awt.Dimension(22, 20));
lblIsland.setText("Island:");
panelSet.setLayout(new javax.swing.BoxLayout(panelSet, javax.swing.BoxLayout.LINE_AXIS));
cbLandSet.setMinimumSize(new java.awt.Dimension(20, 20));
panelSet.add(cbLandSet);
btnSetFastSearch.setIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/search_24.png"))); // NOI18N
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
代码示例来源:origin: runelite/runelite
private void addItemToPanel(FeedItem item)
JPanel avatarAndRight = new JPanel(new BorderLayout());
avatarAndRight.setPreferredSize(new Dimension(0, 56));
JLabel avatar = new JLabel();
avatar.setPreferredSize(new Dimension(52, 48));
avatar.setBorder(new EmptyBorder(0, 4, 0, 0));
avatarAndRight.setBackground(TWEET_BACKGROUND);
break;
case OSRS_NEWS:
JPanel upAndContent = new JPanel();
upAndContent.setLayout(new BoxLayout(upAndContent, BoxLayout.Y_AXIS));
upAndContent.setBorder(new EmptyBorder(4, 8, 4, 4));
upAndContent.setBackground(null);
titleLabel.setBackground(null);
titleLabel.setForeground(darkerForeground);
titleLabel.setPreferredSize(new Dimension(CONTENT_WIDTH - TIME_WIDTH, 0));
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
chatLog.setText("<html><body>");
getContentPane().add(new JScrollPane(chatLog), "Center");
JPanel p = new JPanel();
p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));
p.add(new JLabel("Name:"));
nameField = new JTextField(System.getProperty("user.name", "yourname"));
Dimension d = nameField.getPreferredSize();
nameField.setMaximumSize(new Dimension(120, d.height + 6));
p.add(nameField);
p.add(new JLabel(" Message:"));
messageField = new JTextField();
p.add(messageField);
p.add(new JButton(new SendAction(true)));
p.add(new JButton(new SendAction(false)));
getContentPane().add(p, "South");
代码示例来源:origin: marytts/marytts
protected void initialise(double[] signal, int samplingRate, int width, int height, boolean exitOnClose) {
setSize(width, height);
JPanel zoomPanel = new JPanel();
zoomPanel.setLayout(new BoxLayout(zoomPanel, BoxLayout.Y_AXIS));
getContentPane().add(zoomPanel, BorderLayout.WEST);
JButton zoomIn = new JButton("Zoom In");
zoomIn.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
changeZoomX(2);
zoomPanel.add(zoomIn);
JButton zoomOut = new JButton("Zoom Out");
zoomOut.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
int graphWidth = width - zoomPanel.getPreferredSize().width - 30;
JPanel graphPanel = new JPanel();
graphPanel.setLayout(new BoxLayout(graphPanel, BoxLayout.Y_AXIS));
JScrollPane scroll = new JScrollPane(graphPanel);
scroll.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
scroll.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
getContentPane().add(scroll, BorderLayout.CENTER);
signalGraph = new SignalGraph(signal, samplingRate, graphWidth, height * 15 / 100);
allGraphs.add(signalGraph);
代码示例来源:origin: marytts/marytts
public JFrame showInJFrame(String title, int width, int height, boolean allowZoom, boolean showControls, boolean exitOnClose) {
final JFrame main = new JFrame(title);
int mainWidth = width;
JScrollPane scroll = new JScrollPane(this);
scroll.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
main.getContentPane().add(scroll, BorderLayout.CENTER);
final CursorDisplayer glass = new CursorDisplayer();
main.setGlassPane(glass);
this.addCursorListener(glass);
if (allowZoom) {
JPanel zoomPanel = new JPanel();
zoomPanel.setLayout(new BoxLayout(zoomPanel, BoxLayout.Y_AXIS));
main.getContentPane().add(zoomPanel, BorderLayout.WEST);
zoomPanel.add(Box.createVerticalGlue());
JButton zoomIn = new JButton("Zoom In");
zoomIn.setAlignmentX(CENTER_ALIGNMENT);
zoomIn.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
setZoomX(getZoomX() * 2);
代码示例来源:origin: nodebox/nodebox
JPanel iconPanel = new JPanel();
iconPanel.setLayout(new BoxLayout(iconPanel, BoxLayout.Y_AXIS));
JLabel iconLabel = new JLabel(hostIcon);
controlsPanel.setLayout(new BoxLayout(controlsPanel, BoxLayout.Y_AXIS));
controlsPanel.setMaximumSize(new Dimension(Short.MAX_VALUE, Short.MAX_VALUE));
String desc = host.getName() + " " + item.getVersion() + " is now available - you have " + host.getVersion() + ". Would you like to download it now?";
JLabel alert = new JLabel("<html><b>" + banner + "</b><br><br>" + desc + "<br><b>Release notes:</b></html>");
alert.setAlignmentX(Component.LEFT_ALIGNMENT);
alert.setPreferredSize(new Dimension(Short.MAX_VALUE, 80));
JScrollPane notesScroll = new JScrollPane(notesArea, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
notesScroll.setBorder(BorderFactory.createLineBorder(new Color(137, 137, 137)));
notesScroll.setMaximumSize(new Dimension(Short.MAX_VALUE, Short.MAX_VALUE));
buttonRow.setLayout(new BoxLayout(buttonRow, BoxLayout.X_AXIS));
JButton remindMeLater = new JButton("Remind Me Later");
remindMeLater.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
remindMeLaterClicked();
JButton downloadButton = new JButton("Download");
内容来源于网络,如有侵权,请联系作者删除!