javax.swing.Box.createHorizontalGlue()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(9.7k)|赞(0)|评价(0)|浏览(211)

本文整理了Java中javax.swing.Box.createHorizontalGlue()方法的一些代码示例,展示了Box.createHorizontalGlue()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Box.createHorizontalGlue()方法的具体详情如下:
包路径:javax.swing.Box
类名称:Box
方法名:createHorizontalGlue

Box.createHorizontalGlue介绍

暂无

代码示例

代码示例来源:origin: stanfordnlp/CoreNLP

private static Box getNewFilter() {
 Box filter = Box.createHorizontalBox();
 FilterType[] filterTypeOptions = FilterType.values();
 JComboBox filterTypes = new JComboBox(filterTypeOptions );
 filterTypes.setEditable(false);
 filter.add(filterTypes);
 filter.add(Box.createHorizontalGlue());
 JTextField filterInput = new JTextField();
 //filterInput.setMaximumSize(new Dimension(50,50));
 filterInput.setEditable(true);
 filter.add(filterInput);
 return filter;
}

代码示例来源: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: 4thline/cling

expirationComboBox.setMaximumSize(new Dimension(100, 32));
expirationComboBox.addActionListener(new ActionListener() {
  public void actionPerformed(ActionEvent e) {
toolBar.add(copyButton);
toolBar.add(expandButton);
toolBar.add(Box.createHorizontalGlue());
toolBar.add(configureButton);
toolBar.add(clearButton);
toolBar.add(pauseButton);
toolBar.add(pauseLabel);
toolBar.add(Box.createHorizontalGlue());
toolBar.add(new JLabel("Clear after:"));
toolBar.add(expirationComboBox);

代码示例来源:origin: cmu-phil/tetrad

private Box clusterDisplay() {
  Box b = Box.createVerticalBox();
  b.setBorder(new EmptyBorder(5, 5, 5, 5));
  Box b1 = Box.createHorizontalBox();
  b1.add(Box.createHorizontalGlue());
  b1.add(new JLabel("# Clusters = " + getNumClusters()));
  b.add(b1);
  JPanel clustersPanel = new JPanel();
  clustersPanel.setLayout(new BorderLayout());
  clustersPanel.add(getClusterBoxes(getNumClusters()),
      BorderLayout.CENTER);
  b.add(clustersPanel);
  return b;
}

代码示例来源:origin: cmu-phil/tetrad

/**
 * Creates a left-aligned label.
 */
private static Box createLabel(String text) {
  Box box = Box.createHorizontalBox();
  box.add(new JLabel(text));
  box.add(Box.createHorizontalGlue());
  return box;
}

代码示例来源: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);
    box.setLayout(new BoxLayout(box, BoxLayout.X_AXIS ));
    box.add(Box.createHorizontalGlue());
    box.add(getLabel("Box"));
    box.add(Box.createHorizontalGlue());
    p.add(box);

代码示例来源:origin: nodebox/nodebox

actionHeader.add(Box.createHorizontalStrut(10));
actionHeader.add(actionHeaderLabel);
actionHeader.add(Box.createHorizontalGlue());
final DevicesPopupMenu devicesPopup = new DevicesPopupMenu();
final JButton addDeviceButton = new JButton(plusIcon);
add(actionHeader, BorderLayout.NORTH);
controlPanel = new JPanel(new GridBagLayout());
JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.TRAILING, 5, 5));
buttonPanel.add(closeButton);
add(buttonPanel, BorderLayout.SOUTH);

代码示例来源:origin: protegeproject/protege

private Component createAuthorPanel() {
  Box box = new Box(BoxLayout.LINE_AXIS);
  final JLabel label = new JLabel("Author: ");
  final Font font = label.getFont().deriveFont(Font.BOLD);
  label.setFont(font);
  label.setAlignmentX(0.0f);
  box.add(label);
  authorLabel.setFont(font);
  box.add(authorLabel);
  box.add(Box.createHorizontalGlue());
  return box;
}

代码示例来源:origin: nodebox/nodebox

public PortNotesRow(String notes) {
  setLayout(new BoxLayout(this, BoxLayout.LINE_AXIS));
  notesLabel = new JLabel(notes);
  notesLabel.setFont(Theme.SMALL_FONT);
  notesLabel.setForeground(Theme.TEXT_NORMAL_COLOR);
  notesLabel.setBorder(BorderFactory.createEmptyBorder(TOP_PADDING, 0, BOTTOM_PADDING, 0));
  add(Box.createHorizontalStrut(PortView.LABEL_WIDTH + 10));
  add(this.notesLabel);
  add(Box.createHorizontalGlue());
  setBorder(Theme.PARAMETER_NOTES_BORDER);
}

代码示例来源:origin: org.apache.jmeter/ApacheJMeter_components

private void init() { // WARNING: called from ctor so must not be overridden (i.e. must be private or final)
  setBorder(makeBorder());
  setLayout(new BorderLayout());
  JPanel vertPanel = new VerticalPanel();
  vertPanel.add(makeTitlePanel());
  perIterationCheck = new JCheckBox(JMeterUtils.getResString("update_per_iter"), true); // $NON-NLS-1$
  Box perIterationPanel = Box.createHorizontalBox();
  perIterationPanel.add(perIterationCheck);
  perIterationPanel.add(Box.createHorizontalGlue());
  vertPanel.add(perIterationPanel);
  add(vertPanel, BorderLayout.NORTH);
  add(makeParameterPanel(), BorderLayout.CENTER);
}

代码示例来源:origin: triplea-game/triplea

static JComponent leftBox(final JComponent c) {
 final Box b = new Box(BoxLayout.X_AXIS);
 b.add(c);
 b.add(Box.createHorizontalGlue());
 return b;
}

代码示例来源:origin: skylot/jadx

private void initUI() {
  JPanel panel = new JPanel();
  panel.setLayout(new BoxLayout(panel, BoxLayout.PAGE_AXIS));
  panel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
  panel.add(makeDeobfuscationGroup());
  panel.add(makeDecompilationGroup());
  panel.add(makeEditorGroup());
  panel.add(makeOtherGroup());
  JPanel buttonPane = new JPanel();
  buttonPane.setLayout(new BoxLayout(buttonPane, BoxLayout.LINE_AXIS));
  buttonPane.setBorder(BorderFactory.createEmptyBorder(0, 10, 10, 10));
  buttonPane.add(resetBtn);
  buttonPane.add(Box.createHorizontalGlue());
  buttonPane.add(saveBtn);
  buttonPane.add(Box.createRigidArea(new Dimension(10, 0)));
  buttonPane.add(cancelButton);

代码示例来源:origin: cmu-phil/tetrad

/**
 * Creates the header of the log display.
 */
private JComponent createHeader() {
  JPanel panel = new JPanel();
  panel.setBackground(DisplayNodeUtils.getNodeFillColor());
  panel.setLayout(new BorderLayout());
  String path = TetradLogger.getInstance().getLatestFilePath();
  JLabel label = new JLabel(path == null ? "Logging to console (select Setup... from Logging menu)" : "  Logging to " + path);
  label.setFont(label.getFont().deriveFont(Font.BOLD, 12f));
  label.setBackground(DisplayNodeUtils.getNodeFillColor());
  label.setForeground(Color.WHITE);
  label.setOpaque(false);
  label.setBorder(new EmptyBorder(1, 2, 1, 2));
  Box b = Box.createHorizontalBox();
  b.add(label);
  b.add(Box.createHorizontalGlue());
  panel.add(b, BorderLayout.CENTER);
  return panel;
}

代码示例来源:origin: cmu-phil/tetrad

private Box createLabeledComponent(String label, JComponent comp) {
  Box box = Box.createHorizontalBox();
  box.add(new JLabel(label));
  box.add(Box.createHorizontalStrut(5));
  box.add(comp);
  box.add(Box.createHorizontalGlue());
  return box;
}

代码示例来源:origin: nodebox/nodebox

setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
Dimension d = new Dimension(550, 30);
setPreferredSize(d);
setMaximumSize(d);
setSize(d);
deviceNameLabel = new JLabel(deviceHandler.getName());
portNumberField = new JTextField();
portNumberField.setText(String.valueOf(getPort()));
portNumberField.setPreferredSize(new Dimension(70, portNumberField.getHeight()));
portNumberField.setMinimumSize(new Dimension(70, portNumberField.getHeight()));
add(Box.createHorizontalStrut(5));
add(clearButton);
add(Box.createHorizontalGlue());

代码示例来源:origin: edu.stanford.protege/org.protege.editor.core.application

private Component createAuthorPanel() {
  Box box = new Box(BoxLayout.LINE_AXIS);
  final JLabel label = new JLabel("Author: ");
  final Font font = label.getFont().deriveFont(8);
  label.setFont(font);
  label.setAlignmentX(0.0f);
  box.add(label);
  authorLabel = new JLabel("");
  authorLabel.setFont(font);
  box.add(authorLabel);
  box.add(Box.createHorizontalGlue());
  return box;
}

代码示例来源:origin: magefree/mage

btnConnect = new javax.swing.JButton();
btnSendMessage = new javax.swing.JButton();
lblStatus = new javax.swing.JLabel();
consolePanel1 = new mage.server.console.ConsolePanel();
jToolBar1.add(Box.createHorizontalGlue());
jToolBar1.add(lblStatus);

代码示例来源:origin: info.aduna.commons/aduna-commons-swing

/**
 * Returns a box in which the given component is centered horizontally.
 */
public static Box centerHorizontal(JComponent component) {
  Box row = Box.createHorizontalBox();
  row.add(Box.createHorizontalGlue());
  row.add(component);
  row.add(Box.createHorizontalGlue());
  return row;
}

代码示例来源:origin: apache/geode

selectGraphPane.setPreferredSize(new Dimension(500, 500));
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(apply);
buttonPane.add(cancel);

代码示例来源:origin: cmu-phil/tetrad

private JComponent editor() {
  JPanel panel = new JPanel();
  panel.setLayout(new BorderLayout());
  Box b1 = Box.createVerticalBox();
  Box b2 = Box.createHorizontalBox();
  b2.add(new JLabel("<html>" +
      "The input dataset will be sampled with replacement to create a new" +
      "<br>dataset with the number of samples entered below." +
      "<br>The editable default sample size is 100." + "</html>"));
  Box b7 = Box.createHorizontalBox();
  b7.add(Box.createHorizontalGlue());
  b7.add(new JLabel("<html>" + "<i>Sample size:  </i>" + "</html>"));
  b7.add(sampleSizeField);
  b1.add(Box.createVerticalStrut(5));
  b1.add(b7);
  b1.add(Box.createHorizontalGlue());
  panel.add(b1, BorderLayout.CENTER);

相关文章