本文整理汇总了Java中javax.swing.SwingConstants.TRAILING属性的典型用法代码示例。如果您正苦于以下问题:Java SwingConstants.TRAILING属性的具体用法?Java SwingConstants.TRAILING怎么用?Java SwingConstants.TRAILING使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类javax.swing.SwingConstants
的用法示例。
在下文中一共展示了SwingConstants.TRAILING属性的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setText
public void setText(String value) {
txt = value;
Font font = getFont();
Color fgColor = getForeground();
Color bgColor = getBackground();
value = value.replaceAll("\\n\\r|\\r\\n|\\n|\\r", "<br>"); //NOI18N
value = value.replace("<code>", "<code style=\"font-size: " + font.getSize() + "pt;\">"); //NOI18N
String fgText = "rgb(" + fgColor.getRed() + "," + fgColor.getGreen() + "," + fgColor.getBlue() + ")"; //NOI18N
String bgText = isOpaque() ? "rgb(" + bgColor.getRed() + "," + bgColor.getGreen() + "," + bgColor.getBlue() + ")" : null; //NOI18N
String alignText = null;
switch (halign) {
case SwingConstants.CENTER:
alignText = "center"; //NOI18N
break;
case SwingConstants.RIGHT:
case SwingConstants.TRAILING:
alignText = "right"; //NOI18N
break;
}
String bodyFlags = "text=\"" + fgText + "\""; //NOI18N
if (bgText != null) bodyFlags += " bgcolor=\"" + bgText + "\""; //NOI18N
if (alignText != null) bodyFlags += " align=\"" + alignText + "\""; //NOI18N
super.setText("<html><body " + bodyFlags + " style=\"font-size: " + font.getSize() //NOI18N
+ "pt; font-family: " + font.getName() + ";\">" + value + "</body></html>"); //NOI18N
}
示例2: isLeftAligned
private boolean isLeftAligned(AbstractButton button, int position) {
if (position == SwingConstants.WEST) {
boolean ltr = button.getComponentOrientation().isLeftToRight();
int hAlign = button.getHorizontalAlignment();
return ((ltr && (hAlign == SwingConstants.LEFT ||
hAlign == SwingConstants.LEADING)) ||
(!ltr && (hAlign == SwingConstants.TRAILING)));
}
return false;
}
示例3: isRightAligned
private boolean isRightAligned(AbstractButton button, int position) {
if (position == SwingConstants.EAST) {
boolean ltr = button.getComponentOrientation().isLeftToRight();
int hAlign = button.getHorizontalAlignment();
return ((ltr && (hAlign == SwingConstants.RIGHT ||
hAlign == SwingConstants.TRAILING)) ||
(!ltr && (hAlign == SwingConstants.LEADING)));
}
return false;
}
示例4: PrintCopiesSubJPanel
public PrintCopiesSubJPanel(PrintJDialog objPprintJDialog) {
// Create widgets :
this.objGprintJDialog = objPprintJDialog;
this.objGcopiesJLabel =
new ExtendedJLabel( this.objGprintJDialog.getControlJFrame(),
Tools.getLocaleString("label.numcopies"),
SwingConstants.TRAILING);
this.objGcopiesJLabel.setDisplayedMnemonic(Tools.getMnemonicChar("label.numcopies"));
this.objGcopiesJLabel.getAccessibleContext().setAccessibleName(Tools.getLocaleString("label.numcopies"));
this.objGspinnerNumberModel = new SpinnerNumberModel(1, 1, 999, 1);
this.objGcopiesJSpinner = new JSpinner(this.objGspinnerNumberModel);
this.objGcopiesJSpinner.setOpaque(true);
this.objGcopiesJLabel.setLabelFor(this.objGcopiesJSpinner);
((JSpinner.NumberEditor) this.objGcopiesJSpinner.getEditor()).getTextField().setColumns(3);
this.objGcopiesJSpinner.addChangeListener(this);
this.objGcollateJCheckBox = new JCheckBox(Tools.getLocaleString("checkbox.collate"));
this.objGcollateJCheckBox.setMnemonic(Tools.getMnemonicChar("checkbox.collate"));
this.objGcollateJCheckBox.addActionListener(this);
this.objGcollateJCheckBox.setFont(this.objGprintJDialog.getControlJFrame().getFont());
this.objGcollateJCheckBox.setOpaque(true);
this.objGcollateJCheckBox.setEnabled(false);
// Display widgets :
this.setOpaque(true);
this.setBorder(Tools.getTitledBorder(Tools.getLocaleString("border.copies"), this.objGprintJDialog.getControlJFrame().getFont()));
this.setLayout(new GridBagLayout());
final ExtendedGridBagConstraints objLextendedGridBagConstraints =
new ExtendedGridBagConstraints( GridBagConstraints.RELATIVE,
0,
1,
1,
GridBagConstraints.CENTER,
3,
3,
6,
6,
GridBagConstraints.HORIZONTAL,
1.0F,
1.0F);
this.add(this.objGcopiesJLabel, objLextendedGridBagConstraints);
this.add(this.objGcopiesJSpinner, objLextendedGridBagConstraints);
objLextendedGridBagConstraints.setGridBounds(0, 1, 2, 1);
this.add(this.objGcollateJCheckBox, objLextendedGridBagConstraints);
}
示例5: PrintMediaSubJPanel
public PrintMediaSubJPanel(PrintJDialog objPprintJDialog, PrintMarginsSubJPanel objPprintMarginsSubJPanel) {
this.objGprintJDialog = objPprintJDialog;
this.objGprintMarginsSubJPanel = objPprintMarginsSubJPanel;
this.objGmediaSizeNameAL = new ArrayList<MediaSizeName>();
this.objGsourceMediaTrayAL = new ArrayList<MediaTray>();
// Create widgets :
this.objGsizeJComboBox = new JComboBox<String>();
this.objGsizeJComboBox.setOpaque(true);
this.objGsizeJComboBox.setFont(this.objGprintJDialog.getControlJFrame().getFont());
this.objGsizeJLabel = new JLabel(Tools.getLocaleString("label.size"), SwingConstants.TRAILING);
this.objGsizeJLabel.setDisplayedMnemonic(Tools.getMnemonicChar("label.size"));
this.objGsizeJLabel.setLabelFor(this.objGsizeJComboBox);
this.objGsizeJLabel.setFont(this.objGprintJDialog.getControlJFrame().getFont());
this.objGsizeJLabel.setOpaque(true);
this.objGsourceJComboBox = new JComboBox<String>();
this.objGsourceJComboBox.setOpaque(true);
this.objGsourceJComboBox.setFont(this.objGprintJDialog.getControlJFrame().getFont());
this.objGsourceJLabel = new JLabel(Tools.getLocaleString("label.source"), SwingConstants.TRAILING);
this.objGsourceJLabel.setDisplayedMnemonic(Tools.getMnemonicChar("label.source"));
this.objGsourceJLabel.setLabelFor(this.objGsourceJComboBox);
this.objGsourceJLabel.setOpaque(true);
this.objGsourceJLabel.setFont(this.objGprintJDialog.getControlJFrame().getFont());
// Add widgets :
this.setOpaque(true);
this.setBorder(Tools.getTitledBorder(Tools.getLocaleString("border.media"), this.objGprintJDialog.getControlJFrame().getFont()));
this.setLayout(new GridBagLayout());
final ExtendedGridBagConstraints objLextendedGridBagConstraints =
new ExtendedGridBagConstraints( 0,
GridBagConstraints.RELATIVE,
1,
1,
GridBagConstraints.CENTER,
3,
3,
6,
6,
GridBagConstraints.VERTICAL,
0.0F,
1.0F);
this.add(this.objGsizeJLabel, objLextendedGridBagConstraints);
this.add(this.objGsourceJLabel, objLextendedGridBagConstraints);
objLextendedGridBagConstraints.setGridLocation(1, GridBagConstraints.RELATIVE);
objLextendedGridBagConstraints.setFilling(GridBagConstraints.BOTH, 1.0F, 1.0F);
this.add(this.objGsizeJComboBox, objLextendedGridBagConstraints);
this.add(this.objGsourceJComboBox, objLextendedGridBagConstraints);
}