本文整理汇总了Java中javax.swing.JTextField.setSize方法的典型用法代码示例。如果您正苦于以下问题:Java JTextField.setSize方法的具体用法?Java JTextField.setSize怎么用?Java JTextField.setSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JTextField
的用法示例。
在下文中一共展示了JTextField.setSize方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: MessagePreferencesPanel
import javax.swing.JTextField; //导入方法依赖的package包/类
public MessagePreferencesPanel() {
setLayout(null);
refuseMessages = new JCheckBox("Refuse Messages");
refuseMessages.setSize(150, 25);
refuseMessages.setLocation(10, 25);
refuseMessages.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
updateEnabled();
}
});
add(refuseMessages);
denyMessageLabel = new JLabel("Refusal Message:");
denyMessageLabel.setSize(150, 25);
denyMessageLabel.setLocation(20, 50);
add(denyMessageLabel);
denyMessageText = new JTextField(REFUSAL_MESSAGE_DEFAULT);
denyMessageText.setSize(400, 25);
denyMessageText.setLocation(25, 75);
add(denyMessageText);
setSize(STD_XSIZE, STD_YSIZE);
}
示例2: initPanel1
import javax.swing.JTextField; //导入方法依赖的package包/类
private void initPanel1() {
panel1 = new JPanel();
panel1.setLayout(new GridLayout(3,1));
JLabel label = new JLabel("Inserire password:");
JTextField text = new JTextField();
text.setSize(10, 5);
JButton bottone = new JButton("Accedi");
bottone.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
String s = text.getText();
if (s.hashCode()==password) {
testo.setText("Benvenuto operatore!");
notifyObservers();
}
else {
testo.setText("Password errata!");
}
}
});
panel1.add(label);
panel1.add(text);
panel1.add(bottone);
this.add(panel1);
}
示例3: ViewAlkaneLengthSelection
import javax.swing.JTextField; //导入方法依赖的package包/类
public ViewAlkaneLengthSelection(String frameTitle){
super(frameTitle);
this.setMinimumSize(new Dimension(500,200));
alkaneSpherePanel = new JPanel();
this.add(alkaneSpherePanel);
closeWindow = new JButton("Cancel");
saveValues = new JButton("Save");
GridBagLayout gridbagOtherParam = new GridBagLayout();
alkaneSpherePanel.setLayout(gridbagOtherParam);
NoOfSpheres = new JTextField();
NoOfSpheres.setColumns(10);
NoOfSpheres.setSize(new Dimension(5,20));
NoOfSpheres.setText("4");
JLabel NLabel = new JLabel("Cn (where n is 4 or greater)");
NLabel.setLabelFor(NoOfSpheres);
Border compoundField1;
compoundField1 = BorderFactory.createCompoundBorder(
BorderFactory.createRaisedBevelBorder(), BorderFactory.createLoweredBevelBorder());
NoOfSpheres.setBorder(compoundField1);
JComponent[] OtherParamLeft= {NLabel,saveValues};
JComponent[] OtherParamRight = { NoOfSpheres,closeWindow};
addLeftRightComponents(OtherParamLeft,OtherParamRight,gridbagOtherParam,alkaneSpherePanel);
}
示例4: initComponents
import javax.swing.JTextField; //导入方法依赖的package包/类
private void initComponents() {
setLayout(null);
pack();
insets = getInsets();
doMessageSetup();
setSize(getPreferredSize());
setLayout(null);
messagebox = new JTextField(sample);
messagebox.setSize(MSIZEX, MSIZEY);
messagebox.setLocation(XPAD + insets.left, message.size() * height
+ YPAD + insets.top + 10);
add(messagebox);
buttons = new JButton[] { new JButton("Cancel"), new JButton("Ok") };
for (int i = 0; i < buttons.length; i++) {
buttons[i].addActionListener(new ActionHandler());
buttons[i].setSize(BUTTONX, BUTTONY);
buttons[i].setLocation(getSize().width - (120 * i + 20) - BUTTONX,
getSize().height - BUTTONY - 20 - insets.bottom);
add(buttons[i]);
}
Dimension d = parent.getSize();
Point l = parent.getLocation();
Dimension mysize = getSize();
setLocation(l.x + (d.width - mysize.width) / 2, l.y);
setSize(getPreferredSize());
}
示例5: addColumn
import javax.swing.JTextField; //导入方法依赖的package包/类
public void addColumn() {
amountOfCandidates++;
values.add(0);
JTextField toAdd = new JTextField("0");
toAdd.getDocument().addDocumentListener(this);
toAdd.setSize(elementWidth, elementHeight);
fields.add(toAdd);
update();
}
示例6: ViewSimEnvironmentSelection
import javax.swing.JTextField; //导入方法依赖的package包/类
public ViewSimEnvironmentSelection(ModelSimulationEnvironment simEnvironmentObj){
super();
this.setMinimumSize(new Dimension(500,400));
SimEnvParamPanel = new JPanel();
GridBagLayout gridbagOtherParam = new GridBagLayout();
SimEnvParamPanel.setLayout(gridbagOtherParam);
this.add(SimEnvParamPanel);
closeWindow = new JButton("Cancel");
saveValues = new JButton("Save");
temperatureField = new JTextField();
temperatureField.setColumns(10);
temperatureField.setSize(new Dimension((int)temperatureField.getSize().getWidth(),20));
temperatureField.setText(Double.toString(simEnvironmentObj.getTemperature()));
JLabel temperatureLabel = new JLabel("Temperature(K)");
temperatureLabel.setLabelFor(temperatureField);
Border compoundField1;
compoundField1 = BorderFactory.createCompoundBorder(
BorderFactory.createRaisedBevelBorder(), BorderFactory.createLoweredBevelBorder());
temperatureField.setBorder(compoundField1);
noOfStepsField = new JTextField();
noOfStepsField.setColumns(10);
JLabel NoOfStepsLabel = new JLabel("Steps");
noOfStepsField.setText(Integer.toString(simEnvironmentObj.getNoOfSteps()));
NoOfStepsLabel.setLabelFor(noOfStepsField);
Border compoundField2;
compoundField2 = BorderFactory.createCompoundBorder(
BorderFactory.createRaisedBevelBorder(), BorderFactory.createLoweredBevelBorder());
noOfStepsField.setBorder(compoundField2);
sigmaHSRefField = new JTextField[10];
sigmaHSRefLabel = new JLabel[10];
sigmaHSRefBorder = new Border[10];
for(int i=0;i<10;i++){
sigmaHSRefField[i] = new JTextField();
sigmaHSRefField[i].setColumns(10);
String index = Integer.toString(i+1);
sigmaHSRefLabel[i] = new JLabel("SigmaHSRef"+index);
sigmaHSRefLabel[i].setLabelFor(sigmaHSRefField[i]);
if(simEnvironmentObj.getSigmaHSRef(i) == 0.0){
sigmaHSRefField[i].setText("0.0");
sigmaHSRefField[i].setVisible(false);
sigmaHSRefLabel[i].setVisible(false);
}else{
sigmaHSRefField[i].setText(Double.toString(simEnvironmentObj.getSigmaHSRef(i)));
}
sigmaHSRefBorder[i] = BorderFactory.createCompoundBorder(
BorderFactory.createRaisedBevelBorder(), BorderFactory.createLoweredBevelBorder());
sigmaHSRefField[i].setBorder(sigmaHSRefBorder[i]);
}
JComponent[] OtherParamLeft= {temperatureLabel, NoOfStepsLabel, sigmaHSRefLabel[0],sigmaHSRefLabel[1],sigmaHSRefLabel[2],sigmaHSRefLabel[3],
sigmaHSRefLabel[4],sigmaHSRefLabel[5],sigmaHSRefLabel[6],sigmaHSRefLabel[7],
sigmaHSRefLabel[8],sigmaHSRefLabel[9],saveValues};
JComponent[] OtherParamRight = { temperatureField,noOfStepsField,sigmaHSRefField[0],sigmaHSRefField[1],sigmaHSRefField[2],sigmaHSRefField[3],
sigmaHSRefField[4],sigmaHSRefField[5],sigmaHSRefField[6],sigmaHSRefField[7],
sigmaHSRefField[8],sigmaHSRefField[8],closeWindow};
addLeftRightComponents(OtherParamLeft,OtherParamRight,gridbagOtherParam,SimEnvParamPanel);
Border compound2;
compound2 = BorderFactory.createCompoundBorder(
BorderFactory.createRaisedBevelBorder(), BorderFactory.createLoweredBevelBorder());
SimEnvParamPanel.setBorder(compound2);
}