javax.swing.JTextField.setHorizontalAlignment()方法的使用及代码示例

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

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

JTextField.setHorizontalAlignment介绍

暂无

代码示例

代码示例来源:origin: deathmarine/Luyten

protected JTextField getSampleTextField() {
  if (sampleText == null) {
    Border lowered = BorderFactory.createLoweredBevelBorder();
    sampleText = new JTextField(("AaBbYyZz"));
    sampleText.setHorizontalAlignment(JTextField.CENTER);
    sampleText.setBorder(lowered);
    sampleText.setPreferredSize(new Dimension(300, 100));
  }
  return sampleText;
}

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

setBorder(new EmptyBorder(3, 0, 0, 0));
JPanel nameWrapper = new JPanel(new BorderLayout());
nameWrapper.setBackground(ColorScheme.DARKER_GRAY_COLOR);
nameWrapper.setBorder(NAME_BOTTOM_BORDER);
JPanel mainContainer = new JPanel(new BorderLayout());
mainContainer.setBorder(new EmptyBorder(5, 0, 0, 0));
mainContainer.setBackground(ColorScheme.DARKER_GRAY_COLOR);
contentContainer = new JPanel(new BorderLayout());
contentContainer.setBackground(ColorScheme.DARKER_GRAY_COLOR);
displayInput.setBackground(ColorScheme.DARKER_GRAY_COLOR);
displayInput.setPreferredSize(new Dimension(0, 24));
displayInput.getTextField().setHorizontalAlignment(SwingConstants.CENTER);
displayInput.addActionListener(e -> getParent().requestFocusInWindow());

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

jPanel1 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
requestCountField = new javax.swing.JTextField();
syncRadio = new javax.swing.JRadioButton();
asyncRadio = new javax.swing.JRadioButton();
uriField = new javax.swing.JTextField();
jLabel2 = new javax.swing.JLabel();
runButton = new javax.swing.JButton();
messagePanel = new javax.swing.JPanel();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jPanel2 = new javax.swing.JPanel();
finishStatusLabel = new javax.swing.JLabel();
successRateStatusLabel = new javax.swing.JLabel();
requestCountField.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
requestCountField.setText("10");

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

display = new JTextField();
display.setEditable( false );
display.setHorizontalAlignment(JTextField.RIGHT);
JPanel buttonPanel = new JPanel();
buttonPanel.setLayout( new GridLayout(0, 5) );
buttons = new JButton[10];
  button.setMnemonic( text.charAt(0) );
  buttons[i] = button;
  buttonPanel.add( button );
getContentPane().add(display, BorderLayout.NORTH);
getContentPane().add(buttonPanel, BorderLayout.SOUTH);
setResizable( false );

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

table.setDefaultRenderer(Double.class, new CurrencyRenderer(nf));
table.setDefaultEditor(Double.class, new CurrencyEditor(nf));
this.add(new JScrollPane(table));
  super(new JTextField());
  this.formatter = formatter;
  this.textField = (JTextField) this.getComponent();
  textField.setHorizontalAlignment(JTextField.RIGHT);
  textField.setBorder(null);
JFrame f = new JFrame("RenderEditNumber");
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.add(this);
f.pack();
f.setLocationRelativeTo(null);

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

JPanel p = new JPanel(new GridLayout(0,1));
File f = new File(".","LinkLabel.java");
p.add(linkLabelFile);
p.add(linkLabelWeb);
JPanel labelConstrain = new JPanel(new BorderLayout());
labelConstrain.add( linkLabelConstrain, BorderLayout.EAST );
p.add(labelConstrain);
  setHorizontalAlignment(JTextField.CENTER);
linkLabelNoUnderline.init();
p.add(linkLabelNoUnderline);

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

getEngineByExtension("js");
ui = new JPanel(new BorderLayout(2, 2));
controls = new ArrayList<JButton>();
JPanel text = new JPanel(new GridLayout(0, 1, 3, 3));
ui.add(text, BorderLayout.PAGE_START);
io = new JTextField(15);
Font font = io.getFont();
font = font.deriveFont(font.getSize() * 1.8f);
io.setFont(font);
io.setHorizontalAlignment(SwingConstants.TRAILING);
io.setFocusable(false);
text.add(io);
JPanel buttons = new JPanel(new GridLayout(4, 4, 2, 2));
ui.add(buttons, BorderLayout.CENTER);
String[] keyValues = {
  "7", "8", "9", "/",

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

actionPanel = new javax.swing.JPanel();
txtName = new javax.swing.JTextField();
txtType = new javax.swing.JTextField();
txtStartTime = new javax.swing.JTextField();
txtEndTime = new javax.swing.JTextField();
txtTournamentState = new javax.swing.JTextField();
txtName.setHorizontalAlignment(javax.swing.JTextField.LEFT);
txtName.setBorder(javax.swing.BorderFactory.createEtchedBorder());
txtName.setFocusable(false);
txtType.setHorizontalAlignment(javax.swing.JTextField.LEFT);
txtType.setBorder(javax.swing.BorderFactory.createEtchedBorder());
txtType.setFocusable(false);
txtStartTime.setHorizontalAlignment(javax.swing.JTextField.CENTER);
txtStartTime.setBorder(javax.swing.BorderFactory.createEtchedBorder());
txtStartTime.setFocusable(false);
txtEndTime.setHorizontalAlignment(javax.swing.JTextField.CENTER);
txtEndTime.setBorder(javax.swing.BorderFactory.createEtchedBorder());
txtEndTime.setFocusable(false);
txtTournamentState.setHorizontalAlignment(javax.swing.JTextField.CENTER);
txtTournamentState.setBorder(javax.swing.BorderFactory.createEtchedBorder());
txtTournamentState.setFocusable(false);

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

public TableSpinnerEditor(CardsList cardsList) {
  super(new JTextField());
  this.cardsList = cardsList;
  spinner = new JSpinner();
  editor = ((JSpinner.DefaultEditor) spinner.getEditor());
  textField = editor.getTextField();
  textField.setHorizontalAlignment(JTextField.LEFT);
  textField.addFocusListener(new FocusListener() {
    @Override

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

import java.awt.*;

import javax.swing.*;
import javax.swing.border.*;

public class FrameTest {
  public static void main(String[] args) throws InterruptedException {

    JFrame jf = new JFrame("Demo");
    jf.getContentPane().setLayout(new GridLayout(9, 9, 3, 3));    

    for (int i = 0; i < 9*9; i++) {
      JTextField tf = new JTextField(1);
      tf.setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED));
      tf.setBackground(new Color(230, 230, 230));
      tf.setHorizontalAlignment(JTextField.CENTER);
      tf.setFont(tf.getFont().deriveFont(20f));
      jf.add(tf);
    }

    jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    jf.pack();
    jf.setVisible(true);

  }
}

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

JMenuItem menuItemDump = new JCheckBoxMenuItem("Dump to a file");
JPanel panelCustomFromRow = new JPanel(new BorderLayout());
final JTextField inputCustomFromRow = new JPopupTextField("no.", "1").getProxy();
inputCustomFromRow.setHorizontalAlignment(JTextField.TRAILING);
Dimension d = new Dimension(
  (int) inputCustomFromRow.getPreferredSize().getWidth() + 50,
panelCustomFromRow.add(inputCustomFromRow, BorderLayout.CENTER);
JPanel panelCustomToRow = new JPanel(new BorderLayout());
final JTextField inputCustomToRow = new JPopupTextField("no.", "65565").getProxy();
inputCustomToRow.setHorizontalAlignment(JTextField.TRAILING);
inputCustomToRow.setPreferredSize(d);
panelCustomToRow.add(inputCustomToRow, BorderLayout.CENTER);
JPanel panelCustomFromChar = new JPanel(new BorderLayout());
final JTextField inputCustomFromChar = new JPopupTextField("no.", "1").getProxy();
inputCustomFromChar.setHorizontalAlignment(JTextField.TRAILING);
inputCustomFromChar.setPreferredSize(d);
JPanel panelCustomToChar = new JPanel(new BorderLayout());
final JTextField inputCustomToChar = new JPopupTextField("no.", "65565").getProxy();
inputCustomToChar.setHorizontalAlignment(JTextField.TRAILING);
inputCustomToChar.setPreferredSize(d);

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

JPanel topPanel = new JPanel();
topPanel.setLayout(new BorderLayout());
topPanel.setMinimumSize(d);
topPanel.add(colorField, BorderLayout.WEST);
JPanel hexPanel = new JPanel(null);
hexPanel.setMinimumSize(d);
hexPanel.setPreferredSize(d);
hexPanel.setMaximumSize(d);
hexPanel.setSize(d);
hexField = new JTextField();
hexField.setFont(Theme.SMALL_BOLD_FONT);
hexField.setForeground(Theme.TEXT_NORMAL_COLOR);
hexField.setHorizontalAlignment(JTextField.CENTER);
hexField.setBackground(null);
hexPanel.add(hexField);
JPanel bottomPanel = new JPanel();
bottomPanel.setLayout(new BoxLayout(bottomPanel, BoxLayout.X_AXIS));
bottomPanel.setMinimumSize(d);
contents.add(topPanel);
contents.add(hue);
contents.add(saturation);
contents.add(brightness);
contents.add(Box.createVerticalStrut(12));

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

cardSelector = new mage.client.deckeditor.CardSelector();
deckArea = new mage.client.deckeditor.DeckArea();
jPanel1 = new javax.swing.JPanel();
bigCard = new mage.client.cards.BigCard();
txtDeckName = new javax.swing.JTextField();
lblDeckName = new javax.swing.JLabel();
btnSave = new javax.swing.JButton();
btnAddLand = new javax.swing.JButton();
btnGenDeck = new javax.swing.JButton();
txtTimeRemaining = new javax.swing.JTextField();
txtTimeRemaining.setEditable(false);
txtTimeRemaining.setForeground(java.awt.Color.red);
txtTimeRemaining.setHorizontalAlignment(javax.swing.JTextField.CENTER);
txtTimeRemaining.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));

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

setPreferredSize(d);
numberField = new JTextField();
numberField.putClientProperty("JComponent.sizeVariant", "small");
numberField.setFont(Theme.SMALL_BOLD_FONT);
numberField.setHorizontalAlignment(JTextField.CENTER);
numberField.setVisible(false);
numberField.addKeyListener(new EscapeListener());

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

add(new JButton("Button 1"));
addSeparator();
coords = new JTextField(5);
coords.setEditable(false);
coords.setHorizontalAlignment(JTextField.CENTER);
add(coords);
add(new JButton("Button 2"));

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

textField = new JTextField("Hello");
textField.setHorizontalAlignment(SwingConstants.RIGHT);
buttons = new JPanel();
buttons.add (MC);
buttons.add (MR);
[...]
f.add(buttons);

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

draftLeftPane = new javax.swing.JPanel();
btnQuitTournament = new javax.swing.JButton();
lblPack1 = new javax.swing.JLabel();
txtPack1 = new javax.swing.JTextField();
chkPack1 = new javax.swing.JCheckBox();
lblPack2 = new javax.swing.JLabel();
txtPack2 = new javax.swing.JTextField();
chkPack2 = new javax.swing.JCheckBox();
lblPack3 = new javax.swing.JLabel();
txtPack3 = new javax.swing.JTextField();
chkPack3 = new javax.swing.JCheckBox();
lblCardNo = new javax.swing.JLabel();
lblMessage = new javax.swing.JLabel();
bigCard = new mage.client.cards.BigCard();
jPanel1 = new javax.swing.JPanel();
pnlLeft = new javax.swing.JPanel();
lblPlayer01 = new javax.swing.JLabel();
lblPlayer02 = new javax.swing.JLabel();
txtTimeRemaining.setHorizontalAlignment(javax.swing.JTextField.CENTER);
txtTimeRemaining.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));

代码示例来源:origin: pentaho/mondrian

"schemaPropertyCellEditor.noSelection", noSelect);
stringEditor = new JTextField();
stringEditor.setFont(Font.decode("Dialog"));
stringEditor.setBorder(null);
booleanEditor.setBackground(Color.white);
integerEditor = new JTextField();
integerEditor.setBorder(null);
integerEditor.setHorizontalAlignment(JTextField.RIGHT);
integerEditor.setFont(Font.decode("Courier"));

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

JFrame f = new JFrame("Test");
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JTextField tfCount = new JTextField("42", 8);
tfCount.setHorizontalAlignment(JTextField.CENTER);
tfCount.setFont(tfCount.getFont().deriveFont(50f));
f.add(tfCount, BorderLayout.NORTH);
f.add(new JPanel() { //placeholder

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

JPanel mainPanel = new JPanel(new GridLayout(3, 3));
JPanel[] innerPanels = new JPanel[9];
for (int i = 0; i < innerPanels.length; i++) {
  innerPanels[i] = new JPanel(new GridLayout(3, 3));
  innerPanels[i].setBorder(BorderFactory.createLineBorder(Color.black, PANEL_THICKNESS));
  mainPanel.add(innerPanels[i]);
    grid[i][j] = new JTextField(TF_COLS);
    grid[i][j].setFont(grid[i][j].getFont().deriveFont(Font.BOLD, TF_PTS));
    grid[i][j].setBorder(BorderFactory.createLineBorder(Color.black, TF_THICKNESS));
    grid[i][j].setHorizontalAlignment(JTextField.CENTER);
    int panelIndex = 3 * (i / 3) + j / 3;
    innerPanels[panelIndex].add(grid[i][j]);
add(mainPanel, BorderLayout.CENTER);

相关文章

JTextField类方法