java.awt.FlowLayout.setHgap()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(12.2k)|赞(0)|评价(0)|浏览(426)

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

FlowLayout.setHgap介绍

[英]Sets the horizontal gap between components.
[中]设置零部件之间的水平间隙。

代码示例

代码示例来源:origin: stackoverflow.com

mainLayout.setHgap(hGap);
mainLayout.setVgap(vGap);
buttonLayout.setHgap(hGap);
gui.setBorder(new EmptyBorder(vBorder,hBorder,vBorder,hBorder));
Container c = gui.getTopLevelAncestor();

代码示例来源:origin: stackoverflow.com

centerFrame.setBorder(new LineBorder(Color.BLUE, 6));
FlowLayout flow = (FlowLayout)centerFrame.getLayout();
flow.setHgap(0);
flow.setVgap(0);

代码示例来源:origin: com.eas.platypus/platypus-js-forms

@ScriptFunction
public void setHgap(int aValue) {
  ((FlowLayout) super.getLayout()).setHgap(aValue);
  super.revalidate();
  super.repaint();
}

代码示例来源:origin: org.fuin/utils4swing

private JPanel getPanelTitle() {
  if (panelTitle == null) {
    final FlowLayout flowLayout = new FlowLayout();
    flowLayout.setHgap(10);
    flowLayout.setAlignment(FlowLayout.LEFT);
    flowLayout.setVgap(10);
    panelTitle = new JPanel();
    panelTitle.setLayout(flowLayout);
    panelTitle.setPreferredSize(new Dimension(40, 30));
    panelTitle.add(getLabelTitle(), null);
  }
  return panelTitle;
}

代码示例来源:origin: org.fuin/utils4swing

private JPanel getButtonPanel() {
  if (panelButtons == null) {
    final FlowLayout flowLayout = new FlowLayout();
    flowLayout.setHgap(10);
    flowLayout.setVgap(10);
    panelButtons = new JPanel();
    panelButtons.setLayout(flowLayout);
    panelButtons.setPreferredSize(new Dimension(100, 50));
    panelButtons.setName("buttonPanel");
    panelButtons.add(getButtonCancel(), null);
  }
  return panelButtons;
}

代码示例来源:origin: com.eas.platypus/platypus-js-calendar-widget

/**
     * Creates the Dialog and returns the Result
     * @param MessageOption that was pressed
     */
  private int showConfirmDialog() {
    JTextField tf = new JTextField();

    JPanel calPanel = new JPanel();
    FlowLayout layout = new FlowLayout();
    layout.setAlignment(FlowLayout.LEFT);
    layout.setHgap(0);
    layout.setVgap(0);
    calPanel.setLayout(layout);
    calPanel.add(_calendarBox);

    Object[] msg = { _message, calPanel };
    int result = JOptionPane.showConfirmDialog(_parentComponent, msg, _title, _optionType, _messageType);
    return result;
  }
}

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

public JPanel getRow(String row) {
  if (row == null) {
    row = "a1";
  }
  if (row.equals(CommandMenuItems.CUSTOM_COMMANDS_SUBMENU)) {
    row = "b1";
  }
  if (!rows.containsKey(row)) {
    JPanel newRow = new JPanel();
    ((FlowLayout)(newRow.getLayout())).setVgap(4);
    // This should be default, but just to be clear
    ((FlowLayout)(newRow.getLayout())).setHgap(5);
    if (row.startsWith("a")) {
      primary.add(newRow);
    } else {
      secondary.add(newRow);
    }
    rows.put(row, newRow);
  }
  return rows.get(row);
}

代码示例来源:origin: org.fuin/utils4swing

private JPanel getPanelButtons() {
  if (panelButtons == null) {
    final FlowLayout flowLayout2 = new FlowLayout();
    flowLayout2.setAlignment(FlowLayout.RIGHT);
    flowLayout2.setVgap(10);
    flowLayout2.setHgap(10);
    panelButtons = new JPanel();
    panelButtons.setLayout(flowLayout2);
    panelButtons.setPreferredSize(new Dimension(200, 45));
    panelButtons.add(getCheckBoxIncludeSubdirs(), null);
    panelButtons.add(getButtonCancel(), null);
    panelButtons.add(getButtonOK(), null);
  }
  return panelButtons;
}

代码示例来源:origin: org.jacorb/jacorb

/**
 * Return the CloseButtonPanelFlowLayout property value.
 * @return java.awt.FlowLayout
 */
/* WARNING: THIS METHOD WILL BE REGENERATED. */
private java.awt.FlowLayout getCloseButtonPanelFlowLayout() {
  java.awt.FlowLayout ivjCloseButtonPanelFlowLayout = null;
  try {
    /* Create part */
    ivjCloseButtonPanelFlowLayout = new java.awt.FlowLayout();
    ivjCloseButtonPanelFlowLayout.setAlignment(java.awt.FlowLayout.RIGHT);
    ivjCloseButtonPanelFlowLayout.setHgap(10);
  } catch (java.lang.Throwable ivjExc) {
    handleException(ivjExc);
  };
  return ivjCloseButtonPanelFlowLayout;
}
/**

代码示例来源:origin: net.sf.mpxj/mpxj

/**
* Constructor.
*
* @param label fixed label text
*/
public JLabelledValue(String label)
{
 FlowLayout flowLayout = (FlowLayout) getLayout();
 flowLayout.setAlignment(FlowLayout.LEFT);
 flowLayout.setVgap(0);
 flowLayout.setHgap(0);
 JLabel textLabel = new JLabel(label);
 textLabel.setFont(new Font("Tahoma", Font.BOLD, 11));
 textLabel.setPreferredSize(new Dimension(70, 14));
 add(textLabel);
 m_valueLabel = new JLabel("");
 m_valueLabel.setPreferredSize(new Dimension(80, 14));
 add(m_valueLabel);
}

代码示例来源:origin: joniles/mpxj

/**
* Constructor.
*
* @param label fixed label text
*/
public JLabelledValue(String label)
{
 FlowLayout flowLayout = (FlowLayout) getLayout();
 flowLayout.setAlignment(FlowLayout.LEFT);
 flowLayout.setVgap(0);
 flowLayout.setHgap(0);
 JLabel textLabel = new JLabel(label);
 textLabel.setFont(new Font("Tahoma", Font.BOLD, 11));
 textLabel.setPreferredSize(new Dimension(70, 14));
 add(textLabel);
 m_valueLabel = new JLabel("");
 m_valueLabel.setPreferredSize(new Dimension(80, 14));
 add(m_valueLabel);
}

代码示例来源:origin: robward-scisys/sldeditor

/** Creates the ui. */
private void createUI() {
  scaleGroupPanel = new JPanel();
  FlowLayout flowLayout = (FlowLayout) scaleGroupPanel.getLayout();
  flowLayout.setVgap(0);
  flowLayout.setHgap(0);
  scaleGroupPanel.setBorder(
      BorderFactory.createTitledBorder(
          Localisation.getString(ScaleTool.class, "ScaleTool.scale")));
  scaleButton =
      new ToolButton(
          Localisation.getString(ScaleTool.class, "ScaleTool.scale"),
          "tool/scaletool.png");
  scaleGroupPanel.add(scaleButton);
  scaleButton.setEnabled(false);
  scaleButton.addActionListener(
      new ActionListener() {
        public void actionPerformed(ActionEvent e) {
          ScaleToolPanel scalePanel = new ScaleToolPanel(application);
          scalePanel.populate(sldDataList);
          scalePanel.setVisible(true);
        }
      });
  scaleGroupPanel.setPreferredSize(new Dimension(PANEL_WIDTH, ToolPanel.TOOL_PANEL_HEIGHT));
}

代码示例来源:origin: robward-scisys/sldeditor

/** Creates the ui. */
private void createUI() {
  groupPanel = new JPanel();
  FlowLayout flowLayout = (FlowLayout) groupPanel.getLayout();
  flowLayout.setVgap(0);
  flowLayout.setHgap(0);
  TitledBorder titledBorder =
      BorderFactory.createTitledBorder(
          Localisation.getString(MapBoxTool.class, "MapBoxTool.groupTitle"));
  groupPanel.setBorder(titledBorder);
  // Export to SLD
  exportToSLDButton =
      new ToolButton(
          Localisation.getString(MapBoxTool.class, "MapBoxTool.exportToSLD"),
          "tool/exporttosld.png");
  exportToSLDButton.setEnabled(false);
  exportToSLDButton.addActionListener(
      new ActionListener() {
        public void actionPerformed(ActionEvent e) {
          exportToSLD();
        }
      });
  groupPanel.setPreferredSize(new Dimension(PANEL_WIDTH, ToolPanel.TOOL_PANEL_HEIGHT));
  groupPanel.add(exportToSLDButton);
}

代码示例来源:origin: org.jacorb/jacorb

/**
 * Return the ButtonPanelFlowLayout property value.
 * @return java.awt.FlowLayout
 */
/* WARNING: THIS METHOD WILL BE REGENERATED. */
private java.awt.FlowLayout getButtonPanelFlowLayout() {
  java.awt.FlowLayout ivjButtonPanelFlowLayout = null;
  try {
    /* Create part */
    ivjButtonPanelFlowLayout = new java.awt.FlowLayout();
    ivjButtonPanelFlowLayout.setAlignment(java.awt.FlowLayout.LEFT);
    ivjButtonPanelFlowLayout.setVgap(5);
    ivjButtonPanelFlowLayout.setHgap(10);
  } catch (java.lang.Throwable ivjExc) {
    handleException(ivjExc);
  };
  return ivjButtonPanelFlowLayout;
}
/**

代码示例来源:origin: nroduit/Weasis

private void init() {
  setLayout(new BorderLayout(0, 0));
  JPanel panel = new JPanel();
  panel.setBorder(new TitledBorder(null, getTitle(), TitledBorder.LEADING, TitledBorder.TOP, null, null));
  add(panel, BorderLayout.CENTER);
  panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
  for (Measurement m : ImageStatistics.ALL_MEASUREMENTS) {
    JCheckBox box = new JCheckBox(m.getName(), m.getGraphicLabel());
    panel.add(box);
    map.put(box, m);
    box.addActionListener(e -> {
      Object source = e.getSource();
      if (source instanceof JCheckBox) {
        Measurement measure = map.get(e.getSource());
        if (measure != null) {
          measure.setGraphicLabel(((JCheckBox) source).isSelected());
        }
      }
    });
  }
  JPanel panel2 = new JPanel();
  FlowLayout flowLayout1 = (FlowLayout) panel2.getLayout();
  flowLayout1.setHgap(10);
  flowLayout1.setAlignment(FlowLayout.RIGHT);
  flowLayout1.setVgap(7);
  add(panel2, BorderLayout.SOUTH);
  JButton btnNewButton = new JButton(Messages.getString("restore.values")); //$NON-NLS-1$
  panel2.add(btnNewButton);
  btnNewButton.addActionListener(e -> resetoDefaultValues());
}

代码示例来源:origin: robward-scisys/sldeditor

/** Creates the UI. */
private void createUI() {
  groupPanel = new JPanel();
  FlowLayout flowLayout = (FlowLayout) groupPanel.getLayout();
  flowLayout.setVgap(0);
  flowLayout.setHgap(0);
  groupPanel.setBorder(
      BorderFactory.createTitledBorder(
          Localisation.getString(
              StickyDataSourceTool.class, "StickyDataSourceTool.groupTitle")));
  // Export to YSLD
  stickyButton =
      new ToggleToolButton(
          Localisation.getString(
              StickyDataSourceTool.class, "StickyDataSourceTool.dataSource"),
          "tool/stickydatasource.png");
  stickyButton.setEnabled(true);
  final StickyDataSourceTool callingObj = this;
  stickyButton.addActionListener(
      new ActionListener() {
        public void actionPerformed(ActionEvent e) {
          SLDEditorFile.getInstance()
              .setStickyDataSource(callingObj, stickyButton.isSelected());
        }
      });
  groupPanel.add(stickyButton);
  groupPanel.setPreferredSize(new Dimension(PANEL_WIDTH, ToolPanel.TOOL_PANEL_HEIGHT));
}

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

public LocationButtonsPanel(JTextField textFieldX, JTextField textFieldY, JTextField textFieldZ,
    JTextField textFieldC) {
  FlowLayout flowLayout = (FlowLayout) getLayout();
  flowLayout.setVgap(0);
  flowLayout.setHgap(2);
  this.textFieldX = textFieldX;
  this.textFieldY = textFieldY;
  this.textFieldZ = textFieldZ;
  this.textFieldC = textFieldC;
  buttonCaptureCamera = new JButton(captureCameraCoordinatesAction);
  buttonCaptureCamera.setHideActionText(true);
  add(buttonCaptureCamera);
  buttonCaptureTool = new JButton(captureToolCoordinatesAction);
  buttonCaptureTool.setHideActionText(true);
  add(buttonCaptureTool);
  JButton buttonCenterCamera = new JButton(positionCameraAction);
  buttonCenterCamera.setHideActionText(true);
  add(buttonCenterCamera);
  buttonCenterTool = new JButton(positionToolAction);
  buttonCenterTool.setHideActionText(true);
  add(buttonCenterTool);
  buttonCenterToolNoSafeZ = new JButton(positionToolNoSafeZAction);
  buttonCenterToolNoSafeZ.setHideActionText(true);
  setActuatorName(null);
}

代码示例来源:origin: datacleaner/DataCleaner

@Override
protected List<Entry<String, JComponent>> getFormElements() {
  final List<Entry<String, JComponent>> result = super.getFormElements();
  result.add(new ImmutableEntry<>("Salesforce username", _usernameTextField));
  result.add(new ImmutableEntry<>("Salesforce password", _passwordTextField));
  final DCPanel securityTokenPanel = new DCPanel(Color.WHITE);
  final FlowLayout layout = (FlowLayout) securityTokenPanel.getLayout();
  layout.setVgap(0);
  layout.setHgap(0);
  final HelpIcon securityTokenHelpIcon = new HelpIcon("Your security token is set on Salesforce.com by going "
      + "to: <b><i>Your Name</i> | Setup | My Personal Information | Reset Security Token</b>.<br/>This "
      + "security token is needed in order to use the Salesforce.com web services.");
  securityTokenHelpIcon.setBorder(WidgetUtils.BORDER_EMPTY);
  _securityTokenTextField.setBorder(WidgetUtils.BORDER_EMPTY);
  securityTokenPanel.add(_securityTokenTextField);
  securityTokenPanel.add(securityTokenHelpIcon);
  result.add(new ImmutableEntry<>("Salesforce security token", securityTokenPanel));
  result.add(new ImmutableEntry<>("Endpoint", _endpointUrlComboBox));
  return result;
}

代码示例来源:origin: datacleaner/DataCleaner

@Override
protected List<Entry<String, JComponent>> getFormElements() {
  final List<Entry<String, JComponent>> result = super.getFormElements();
  final DCPanel baseUrlPanel = new DCPanel(Color.WHITE);
  final FlowLayout layout = (FlowLayout) baseUrlPanel.getLayout();
  layout.setVgap(0);
  layout.setHgap(0);
  final HelpIcon baseUrlHelpIcon = new HelpIcon(
      "The base URL is the first part of any URL that you use when you access the SugarCRM system.");
  baseUrlHelpIcon.setBorder(WidgetUtils.BORDER_EMPTY);
  _baseUrlTextField.setBorder(WidgetUtils.BORDER_EMPTY);
  baseUrlPanel.add(_baseUrlTextField);
  baseUrlPanel.add(baseUrlHelpIcon);
  result.add(new ImmutableEntry<>("Salesforce security token", baseUrlPanel));
  result.add(new ImmutableEntry<>("Salesforce username", _usernameTextField));
  result.add(new ImmutableEntry<>("Salesforce password", _passwordTextField));
  return result;
}

代码示例来源:origin: nroduit/Weasis

public WtoolBar(String barName, int position) {
  FlowLayout flowLayout = (FlowLayout) getLayout();
  flowLayout.setVgap(0);
  flowLayout.setHgap(0);
  flowLayout.setAlignment(FlowLayout.LEADING);
  this.barName = barName;
  this.barPosition = position;
  this.setAlignmentX(LEFT_ALIGNMENT);
  this.setAlignmentY(TOP_ALIGNMENT);
  setOpaque(false);
  addSeparator(SEPARATOR_2x24);
}

相关文章