當前位置: 首頁>>代碼示例>>Java>>正文


Java JTextField.setSize方法代碼示例

本文整理匯總了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);
}
 
開發者ID:addertheblack,項目名稱:myster,代碼行數:26,代碼來源:MessageManager.java

示例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);
}
 
開發者ID:IngSW-unipv,項目名稱:Progetto-E,代碼行數:30,代碼來源:GUIOperatoreLogin.java

示例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);
	
	
}
 
開發者ID:etomica,項目名稱:etomica,代碼行數:31,代碼來源:ViewAlkaneLengthSelection.java

示例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());

}
 
開發者ID:addertheblack,項目名稱:myster,代碼行數:33,代碼來源:AskDialog.java

示例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();
}
 
開發者ID:Skypr,項目名稱:BEAST,代碼行數:14,代碼來源:RowOfValues.java

示例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);

}
 
開發者ID:etomica,項目名稱:etomica,代碼行數:77,代碼來源:ViewSimEnvironmentSelection.java


注:本文中的javax.swing.JTextField.setSize方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。