javax.swing.JComponent.setAlignmentY()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(6.6k)|赞(0)|评价(0)|浏览(177)

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

JComponent.setAlignmentY介绍

暂无

代码示例

代码示例来源:origin: ron190/jsql-injection

this.borderInsets.top = this.component.getPreferredSize().height + this.gap;
  this.component.setAlignmentX(this.alignment);
  this.component.setAlignmentY(0.0f);
} else if (this.edge == Edge.BOTTOM) {
  this.borderInsets.bottom = this.component.getPreferredSize().height + this.gap;
  this.component.setAlignmentX(this.alignment);
  this.component.setAlignmentY(1.0f);
} else if (this.edge == Edge.LEFT) {
  this.borderInsets.left = this.component.getPreferredSize().width + this.gap;
  this.component.setAlignmentX(0.0f);
  this.component.setAlignmentY(this.alignment);
} else if (this.edge == Edge.RIGHT) {
  this.borderInsets.right = this.component.getPreferredSize().width + this.gap;
  this.component.setAlignmentX(1.0f);
  this.component.setAlignmentY(this.alignment);

代码示例来源:origin: camunda/camunda-bpm-platform

tb.add(newButton);
newButton.setAlignmentY(0.5f);
newButton.setAlignmentX(0.5f);

代码示例来源:origin: ganshane/shakey

public void add(JComponent comp) {
    comp.setAlignmentY(0);
    super.add( comp);
  }
}

代码示例来源:origin: JetBrains/jediterm

public Component add(Component comp) {
  ((JComponent) comp).setAlignmentY(0f);
  return super.add(comp);
 }
};

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

public static void addAligned(final Container container, final JComponent component) {
  component.setAlignmentX(Component.LEFT_ALIGNMENT);
  component.setAlignmentY(Component.TOP_ALIGNMENT);
  container.add(component);
}

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

/**
   * {@inheritDoc}
   */
  @Override
  public Component add(Component c) {
    // This won't work right if we remove components. But we don't, so I'm
    // not going to worry about it right now.
    if (hgap > 0 && subPanel.getComponentCount() > 0) {
      subPanel.add(Box.createHorizontalStrut(hgap));
    }

    if (c instanceof JComponent) {
      ((JComponent) c).setAlignmentY(verticalAlign);
    }
    return subPanel.add(c);
  }
}

代码示例来源:origin: com.tourgeek.thin.app/com.tourgeek.thin.app.booking

/**
 * Add any applet sub-panel(s) now.
 */
public boolean addSubPanels(Container parent)
{
  JComponent topPane = new ItinScreen(this, null);
  topPane.setAlignmentX(Component.LEFT_ALIGNMENT);
  topPane.setAlignmentY(Component.BOTTOM_ALIGNMENT);
  parent.add(topPane);
  return true;
}
/**

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

JComponent fields = new JPanel(new GridBagLayout());
fields.setOpaque(false);

GridBagConstraints gbc = new GridBagConstraints();
gbc.gridwidth = GridBagConstraints.REMAINDER;
gbc.anchor = GridBagConstraints.BASELINE_LEADING;
fields.add(tf, gbc);
gbc.insets.top = 6;
fields.add(label, gbc);
fields.add(button1, gbc);

fields.setAlignmentX(JComponent.CENTER_ALIGNMENT);
fields.setAlignmentY(JComponent.CENTER_ALIGNMENT);
bg.setAlignmentX(JComponent.CENTER_ALIGNMENT);
bg.setAlignmentY(JComponent.CENTER_ALIGNMENT);

JPanel overlay = new JPanel();
overlay.setLayout(new OverlayLayout(overlay));
overlay.add(fields);
overlay.add(bg);

frame.getContentPane().add(overlay);

代码示例来源:origin: com.tourgeek.thin.app/com.tourgeek.thin.app.booking

/**
 * Add any applet sub-panel(s) now.
 */
public boolean addSubPanels(Container parent, FieldList record)
{
  JComponent topPane = new JContactScreen(this, record);
  topPane.setAlignmentX(Component.LEFT_ALIGNMENT);
  topPane.setAlignmentY(Component.BOTTOM_ALIGNMENT);
  parent.add(topPane);
  return true;
}
/**

代码示例来源:origin: JetBrains/jediterm

@SuppressWarnings({"MethodOverridesStaticMethodOfSuperclass", "UnusedDeclaration"})
public static ComponentUI createUI(JComponent c) {
 c.setOpaque(false);
 c.setAlignmentY(0.5f);
 return new OnOffButtonUI((OnOffButton)c);
}

代码示例来源:origin: undera/jmeter-plugins

borderInsets.top = component.getPreferredSize().height + gap;
  component.setAlignmentX(alignment);
  component.setAlignmentY(0.0f);
} else if (edge == Edge.BOTTOM) {
  borderInsets.bottom = component.getPreferredSize().height + gap;
  component.setAlignmentX(alignment);
  component.setAlignmentY(1.0f);
} else if (edge == Edge.LEFT) {
  borderInsets.left = component.getPreferredSize().width + gap;
  component.setAlignmentX(0.0f);
  component.setAlignmentY(alignment);
} else if (edge == Edge.RIGHT) {
  borderInsets.right = component.getPreferredSize().width + gap;
  component.setAlignmentX(1.0f);
  component.setAlignmentY(alignment);

代码示例来源:origin: kg.apc/jmeter-plugins-cmn-jmeter

borderInsets.top = component.getPreferredSize().height + gap;
  component.setAlignmentX(alignment);
  component.setAlignmentY(0.0f);
} else if (edge == Edge.BOTTOM) {
  borderInsets.bottom = component.getPreferredSize().height + gap;
  component.setAlignmentX(alignment);
  component.setAlignmentY(1.0f);
} else if (edge == Edge.LEFT) {
  borderInsets.left = component.getPreferredSize().width + gap;
  component.setAlignmentX(0.0f);
  component.setAlignmentY(alignment);
} else if (edge == Edge.RIGHT) {
  borderInsets.right = component.getPreferredSize().width + gap;
  component.setAlignmentX(1.0f);
  component.setAlignmentY(alignment);

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

this.setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
label.setText(name);
label.setAlignmentY(JLabel.TOP_ALIGNMENT);
text.setAlignmentY(JTextField.TOP_ALIGNMENT);
this.add(label);
this.add(text);

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-testng-ui

optCode.setAlignmentY(0.0f);
optComments.setAlignmentY(0.0f);

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-junit-ui

optCode.setAlignmentY(0.0f);
optComments.setAlignmentY(0.0f);

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

tabbedPane.add("2", new JTextField("two"));
tabbedPane.setAlignmentX(1.0f);
tabbedPane.setAlignmentY(0.0f);
checkBox.setAlignmentY(0.0f);

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

field.setAlignmentY(0.0f);    
panel.add(field);

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

public void actionPerformed(ActionEvent e) {
  JLabel text = new JLabel("Original Text");
  text.setAlignmentY(0.8f);
  text.setOpaque(true);
  text.setBackground(Color.yellow);

代码示例来源:origin: com.tourgeek.thin.app/com.tourgeek.thin.app.booking

/**
 * Add the description labels to the first column of the grid.
 */
public JComponent addScreenLabel(Container parent, Converter fieldInfo)
{
  GridBagConstraints c = this.getGBConstraints();
  c.gridy = GridBagConstraints.RELATIVE;  // Bump Row each time
  if (fieldInfo.getFieldName().equals(Product.PRODUCT_TYPE))
  {
    BaseApplet applet = this.getBaseApplet();
    c.gridy = 0;
    c.gridx = 4;                            // Column 3
    ((FieldInfo)fieldInfo).setFieldDesc(applet.getString(SearchConstants.DATE));    // Don't display the desc.
    JComponent component = super.addScreenLabel(parent, fieldInfo);
    component.setAlignmentX(LEFT_ALIGNMENT);
    component.setAlignmentY(TOP_ALIGNMENT);
    return component;
  }
  return super.addScreenLabel(parent, fieldInfo);
}
/**

代码示例来源:origin: org.fudaa.framework.ctulu/ctulu-ui

((JComponent) comp).setAlignmentY(0.5f);
((JComponent) comp).setOpaque(false);
((JComponent) comp).setFont(_list.getFont());

相关文章

JComponent类方法