当前位置: 首页>>代码示例>>Java>>正文


Java JTextField.setPreferredSize方法代码示例

本文整理汇总了Java中javax.swing.JTextField.setPreferredSize方法的典型用法代码示例。如果您正苦于以下问题:Java JTextField.setPreferredSize方法的具体用法?Java JTextField.setPreferredSize怎么用?Java JTextField.setPreferredSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.swing.JTextField的用法示例。


在下文中一共展示了JTextField.setPreferredSize方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createStep2Panel

import javax.swing.JTextField; //导入方法依赖的package包/类
/**
 * Creates and returns the GUI components for step2.
 *
 * @return
 */
private Component createStep2Panel() {
	JPanel panel = new JPanel();
	panel.setLayout(new GridBagLayout());
	GridBagConstraints gbc = new GridBagConstraints();

	gbc.gridx = 0;
	gbc.gridy = 0;
	gbc.weightx = 1;
	gbc.fill = GridBagConstraints.BOTH;
	gbc.insets = new Insets(0, 51, 0, 0);

	codeText = new JTextField();
	codeText.setMinimumSize(new Dimension(80, 33));
	codeText.setPreferredSize(new Dimension(80, 33));
	panel.add(codeText, gbc);

	panel.setBorder(new RoundTitledBorder(2, I18N.getMessage(I18N.getGUIBundle(),
			"gui.dialog.oauth_dialog.copy_code.label"), false));
	return panel;
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:26,代码来源:OAuthDialog.java

示例2: createLocationSector

import javax.swing.JTextField; //导入方法依赖的package包/类
private Component createLocationSector() {
    JPanel panel = new JPanel(new BorderLayout());
    location = new JTextField();
    location.setPreferredSize(new Dimension(180, location
            .getPreferredSize().height));
    JButton button = new JButton("...");
    button.setToolTipText("Base.Location.ToolTip");
    button.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            JFileChooser chooser = new JFileChooser(location.getText());
            chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
            chooser.setAcceptAllFileFilterUsed(false);
            if (chooser.showOpenDialog(Preferences.this) == JFileChooser.APPROVE_OPTION) {
                location.setText(chooser.getSelectedFile()
                        .getAbsolutePath());
            }

        }
    });
    panel.add(location, BorderLayout.CENTER);
    panel.add(button, BorderLayout.EAST);
    return panel;
}
 
开发者ID:Vitaliy-Yakovchuk,项目名称:ramus,代码行数:25,代码来源:Preferences.java

示例3: startRename

import javax.swing.JTextField; //导入方法依赖的package包/类
private void startRename() {
	
	// init the text box
	final JTextField text = new JTextField();
	text.setText(m_reference.getNamableName());
	text.setPreferredSize(new Dimension(360, text.getPreferredSize().height));
	text.addKeyListener(new KeyAdapter() {
		@Override
		public void keyPressed(KeyEvent event) {
			switch (event.getKeyCode()) {
				case KeyEvent.VK_ENTER:
					finishRename(text, true);
				break;
				
				case KeyEvent.VK_ESCAPE:
					finishRename(text, false);
				break;
			}
		}
	});
	
	// find the label with the name and replace it with the text box
	JPanel panel = (JPanel)m_infoPanel.getComponent(0);
	panel.remove(panel.getComponentCount() - 1);
	panel.add(text);
	text.grabFocus();
	text.selectAll();
	
	redraw();
}
 
开发者ID:cccssw,项目名称:enigma-vk,代码行数:31,代码来源:Gui.java

示例4: NewDatabaseDialog

import javax.swing.JTextField; //导入方法依赖的package包/类
public NewDatabaseDialog() {
	newDatabaseNameField = new JTextField();
	nextButton = new JButton("NEXT");
	newDatabaseNameField.setPreferredSize(new Dimension(TEXTFIELD_WIDTH, TEXTFIELD_HEIGHT));
	
	setLayout(new BorderLayout());
	
	EmptyBorder padding = new EmptyBorder(5, 5, 5, 5);
	JPanel textFieldPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
	JPanel buttonsPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
	
	textFieldPanel.setBorder(padding);
	buttonsPanel.setBorder(padding);
	
	textFieldPanel.add(new JLabel("DB name: "));
	textFieldPanel.add(newDatabaseNameField);
	buttonsPanel.add(nextButton);
	
	add(textFieldPanel, BorderLayout.NORTH);
	add(buttonsPanel, BorderLayout.SOUTH);
	
	buildWindow();
}
 
开发者ID:tteguayco,项目名称:JITRAX,代码行数:24,代码来源:NewDatabaseDialog.java

示例5: fixPrefSize

import javax.swing.JTextField; //导入方法依赖的package包/类
private static void fixPrefSize(JTextField textField) {
    // The preferred size of JTextField on (Classic) Windows look and feel
    // is one pixel shorter. The following code is a workaround.
    textField.setPreferredSize(null);
    Dimension dim = textField.getPreferredSize();
    Dimension fixedDim = new Dimension(dim.width+1, dim.height);
    textField.setPreferredSize(fixedDim);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:IssuePanel.java

示例6: createPropertieINput

import javax.swing.JTextField; //导入方法依赖的package包/类
/** 
*	Create a property in PropertiesPanel
**/
protected void createPropertieINput(DefaultValueTypeProperty prop){
JTextField jtf = new JTextField(3);
// property default value
jtf.setText(prop.getValue());
jtf.setPreferredSize(new Dimension(200,20));	 	
jtf.setMaximumSize(new Dimension(200,20));	 	
// proprpety name
JLabel jl = new JLabel(prop.getName());
propertiesPanel.add(jl); 
propertiesPanel.add(jtf);
}
 
开发者ID:guilhebl,项目名称:routerapp,代码行数:15,代码来源:SpecialGraphWindow.java

示例7: createGUI

import javax.swing.JTextField; //导入方法依赖的package包/类
protected void createGUI()
{
	GridBagLayout gridbag = new GridBagLayout();
	GridBagConstraints c = new GridBagConstraints();

	setLayout(gridbag);
	setMaximumSize(new Dimension(Short.MAX_VALUE, Short.MAX_VALUE));

	target = new JTextField();
	target.setEditable(false);
	target.setMinimumSize(new Dimension(150, 20));
	target.setPreferredSize(new Dimension(150, 20));
	target.setMaximumSize(new Dimension(150, 20));
	c.gridx = 0;
	c.weightx = 1;
	c.gridy = 0;
	c.fill = GridBagConstraints.HORIZONTAL;
	gridbag.setConstraints(target, c);
	add(target);

	search = new JButton("...");
	search.setFont(new Font("Sans Serif", Font.PLAIN, 8));
	search.addActionListener(this);
	search.setMinimumSize(new Dimension(18, 20));
	search.setPreferredSize(new Dimension(18, 20));
	search.setMaximumSize(new Dimension(18, 20));

	c.gridx = 1;
	c.weightx = 0;
	gridbag.setConstraints(search, c);
	add(search);
}
 
开发者ID:equella,项目名称:Equella,代码行数:33,代码来源:WhereTargetChooser.java

示例8: createGUI

import javax.swing.JTextField; //导入方法依赖的package包/类
private void createGUI()
{
	GridBagLayout gridbag = new GridBagLayout();
	GridBagConstraints c = new GridBagConstraints();

	setLayout(gridbag);
	setMaximumSize(new Dimension(Short.MAX_VALUE, Short.MAX_VALUE));

	target = new JTextField();
	target.setEditable(false);
	target.setMinimumSize(new Dimension(150, 20));
	target.setPreferredSize(new Dimension(150, 20));
	target.setMaximumSize(new Dimension(150, 20));
	c.gridx = 0;
	c.weightx = 1;
	c.gridy = 0;
	c.fill = GridBagConstraints.HORIZONTAL;
	gridbag.setConstraints(target, c);
	add(target);

	JButton search = new JButton("..."); //$NON-NLS-1$
	search.setFont(new Font("Sans Serif", Font.PLAIN, 8)); //$NON-NLS-1$
	search.addActionListener(new SearchHandler());
	search.setMinimumSize(new Dimension(18, 20));
	search.setPreferredSize(new Dimension(18, 20));
	search.setMaximumSize(new Dimension(18, 20));
	c.gridx = 1;
	c.weightx = 0;
	gridbag.setConstraints(search, c);
	add(search);
}
 
开发者ID:equella,项目名称:Equella,代码行数:32,代码来源:ScriptTargetChooser.java

示例9: makeGUIControl

import javax.swing.JTextField; //导入方法依赖的package包/类
@Override
public JComponent makeGUIControl() {

	final JPanel pan = new JPanel();
	pan.setAlignmentX(Component.LEFT_ALIGNMENT);
	pan.setLayout(new BoxLayout(pan, BoxLayout.X_AXIS));

	final JLabel label = new JLabel(getName());
	label.setToolTipText(
		"<html>" + toString() + "<br>" + getDescription() + "<br>Enter value or use mouse wheel or arrow keys to change value.");
	pan.add(label);

	final JTextField tf = new JTextField();
	tf.setText(Integer.toString(get()));
	tf.setPreferredSize(prefDimensions);
	tf.setMaximumSize(maxDimensions);
	SPIConfigIntActions actionListeners = new SPIConfigIntActions(this);
	tf.addActionListener(actionListeners);
	tf.addFocusListener(actionListeners);
	tf.addKeyListener(actionListeners);
	tf.addMouseWheelListener(actionListeners);
	pan.add(tf);
	setControl(tf);
	addObserver(biasgen);	// This observer is responsible for sending data to hardware
	addObserver(this);		// This observer is responsible for GUI update. It calls the updateControl() method
	return pan;
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:28,代码来源:SPIConfigInt.java

示例10: PartPanel

import javax.swing.JTextField; //导入方法依赖的package包/类
private PartPanel(final PartObj part)
{
	this.part = part;

	setLayout(new GridBagLayout());
	setBorder(BorderFactory.createLineBorder(Color.black));

	GridBagConstraints c = new GridBagConstraints();
	c.insets = new Insets(0,3,0,3);
	c.anchor = GridBagConstraints.CENTER;
	c.gridx = 0;
	c.gridy = 0;
	c.weightx = 1;
	add(new JLabel(part.getDisplayName()),c);

	c.gridx = 1;
	c.weightx = 0;
	c.anchor = GridBagConstraints.EAST;
	JTextField textField = new JTextField(part.getDisplayName());
	textField.getDocument().addDocumentListener(new DisplayNameDocumentListener(part, textField));
	textField.setPreferredSize(new Dimension(200,22));
	add(textField, c);

	c.gridx = 2;
	c.weightx = 0;
	box = new JComboBox();
	box.setPreferredSize(new Dimension(200,20));
	box.addActionListener(new GroupDropDownActionListener(part));
	box.setSelectedItem(controller.getPartGroups().getPartGroup(part));
	add(box, c);

	c.weightx = 0;
	c.gridx = 3;
	DragPanel dp = new DragPanel(this);
	c.anchor = GridBagConstraints.EAST;
	add(dp, c);

	//Mouse listener to highlight part when panel entered.
	addMouseListener(new BlankMouseListener()
	{
		@Override
		public void mouseEntered(MouseEvent e) 
		{
			controller.setSelectedPart(part);
		}
	});
}
 
开发者ID:ObsidianSuite,项目名称:ObsidianSuite,代码行数:48,代码来源:EntitySetupPartPanel.java

示例11: TickPanel

import javax.swing.JTextField; //导入方法依赖的package包/类
public TickPanel(String value, int type) {
  super(new GridBagLayout());
  set(value);

  panelType = type;

  GridBagConstraints c = new GridBagConstraints();
  c.fill = GridBagConstraints.BOTH;
  c.ipadx = 1;
  c.weightx = 0.0;
  c.gridx = 0;
  c.gridy = 0;

  Dimension minSize;

  if (panelType == TICKS_VAL || panelType == TICKS_VALMAX) {
    valField = new JTextField(Integer.toString(numTicks));
    minSize = valField.getMinimumSize();
    minSize.width = 24;
    valField.setMinimumSize(minSize);
    valField.setPreferredSize(minSize);
    valField.addActionListener(this);
    valField.addFocusListener(this);
    add(valField, c);
    ++c.gridx;
  }
  if (panelType == TICKS_MAX || panelType == TICKS_VALMAX) {
    maxField = new JTextField(Integer.toString(maxTicks));
    minSize = maxField.getMinimumSize();
    minSize.width = 24;
    maxField.setMinimumSize(minSize);
    maxField.setPreferredSize(minSize);
    maxField.addActionListener(this);
    maxField.addFocusListener(this);
    if (panelType == TICKS_VALMAX) {
      add(new JLabel("/"), c);
      ++c.gridx;
    }
    add(maxField, c);
    ++c.gridx;
  }

  ticks = new TickLabel(numTicks, maxTicks, panelType);
  ticks.addActionListener(this);
  c.weightx = 1.0;
  add(ticks, c);
  doLayout();
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:49,代码来源:PropertySheet.java

示例12: IndividualDataPanel

import javax.swing.JTextField; //导入方法依赖的package包/类
public IndividualDataPanel(ZooracleContentPanel zooracleContentPanel)
	{
		this.zooracleContentPanel = zooracleContentPanel;
		
		labelName     = GUISettings.getDefaultLabel(Locale.labelName, lw, lh, a, va); 
		labelGender   = GUISettings.getDefaultLabel(Locale.labelSex, lw, lh, a, va);
		labelComment  = GUISettings.getDefaultLabel(Locale.labelComment, lw, 80, a, va);
		labelMetaData = GUISettings.getDefaultLabel(Locale.labelMetaData, lw, 100, a, va);
		
		textFieldName = new JTextField("");   textFieldName.setPreferredSize(new Dimension(200, 30)); textFieldName.setBorder(BorderFactory.createLineBorder(Color.BLACK));
		textAreaComment = new JTextArea();  textAreaComment.setPreferredSize(new Dimension(200, 80)); 
		textAreaComment.setBorder(BorderFactory.createLineBorder(Color.BLACK));
		
		comboBoxGender = new JComboBox(); 
//		comboBoxGender.setBorder(BorderFactory.createLineBorder(Color.BLACK));
		for (Object item : Locale.dropDownGenders)
			comboBoxGender.addItem(item);
		
		// Create some items to add to the list
		String listData[] =
		{
			"BT_1.1",
			"BT_1.2",
			"BT_1.3",
			"BT_1.4"
		};
		
		metaList = new JList(listData);
		JScrollPane metaScrollPane = new JScrollPane(metaList, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
		metaScrollPane.setPreferredSize(new Dimension(200, 100));
		
		
		this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
		
		JPanel panelName     = new JPanel(new FlowLayout(FlowLayout.LEFT)); 
		JPanel panelGender   = new JPanel(new FlowLayout(FlowLayout.LEFT));
		JPanel panelComment  = new JPanel(new FlowLayout(FlowLayout.LEFT));
		JPanel panelMetaList = new JPanel(new FlowLayout(FlowLayout.LEFT));
		
		
		panelName.add(labelName);
		panelName.add(textFieldName);

		panelGender.add(labelGender);
		panelGender.add(comboBoxGender);

		panelComment.add(labelComment);
		panelComment.add(textAreaComment);

		panelMetaList.add(labelMetaData);
		panelMetaList.add(metaScrollPane);
		
		this.add(panelName);
		this.add(panelGender);
		this.add(panelComment);
		this.add(panelMetaList);
		
		this.setBackground(GUISettings.windowColor);
		this.setForeground(GUISettings.windowColor);
		
		this.setMinimumSize(new Dimension(300, 500));
		
		
	}
 
开发者ID:fossasia,项目名称:zooracle,代码行数:65,代码来源:IndividualDataPanel.java

示例13: ToadDataPanel

import javax.swing.JTextField; //导入方法依赖的package包/类
public ToadDataPanel(DisplayMode displayMode)
{
	super(displayMode);
	

	comboBoxPopulation = new JComboBox(); 
	for (Object item : Locale.dropDownPopulations)
		comboBoxPopulation.addItem(item);	
	comboBoxPopulation.setPreferredSize(new Dimension(iw, lh));
	
	textFieldSize1 = new JTextField("");   textFieldSize1.setPreferredSize(new Dimension(iw, 30)); textFieldSize1.setBorder(BorderFactory.createLineBorder(Color.BLACK));
	textFieldSize2 = new JTextField("");   textFieldSize2.setPreferredSize(new Dimension(iw, 30)); textFieldSize2.setBorder(BorderFactory.createLineBorder(Color.BLACK));
	textFieldWeight = new JTextField("");   textFieldWeight.setPreferredSize(new Dimension(iw, 30)); textFieldWeight.setBorder(BorderFactory.createLineBorder(Color.BLACK));
	textFieldTotal = new JTextField("");   textFieldTotal.setPreferredSize(new Dimension(iw, 30)); textFieldTotal.setBorder(BorderFactory.createLineBorder(Color.BLACK));
	textFieldTotal.setEditable(false);
	
	labelPopulation =     GUISettings.getDefaultLabel(Locale.labelPopulation, lw, lh, a, va);  
	labelSize1 =          GUISettings.getDefaultLabel(Locale.labelSize1, lw, lh, a, va);  		
	labelSize2 =          GUISettings.getDefaultLabel(Locale.labelSize2, lw, lh, a, va);  		
	labelSizeTotal =      GUISettings.getDefaultLabel(Locale.labelSizeTotal, lw, lh, a, va);  		
	labelWeight =         GUISettings.getDefaultLabel(Locale.labelWeight, lw, lh, a, va);  		

	JPanel panelSize1                   = new JPanel(new FlowLayout(orientation)); 
	JPanel panelSize2                   = new JPanel(new FlowLayout(orientation)); 
	JPanel panelSizeTotal               = new JPanel(new FlowLayout(orientation)); 
	JPanel panelWeight                  = new JPanel(new FlowLayout(orientation)); 
	JPanel panelPopulation              = new JPanel(new FlowLayout(orientation)); 
	
	if (currentDisplayMode.equals(DisplayMode.vertical_align_left))
	{
		panelSize1.add(textFieldSize1);		
		panelSize1.add(labelSize1);
		panelSize2.add(textFieldSize2);		
		panelSize2.add(labelSize2);
		panelSizeTotal.add(textFieldTotal);		
		panelSizeTotal.add(labelSizeTotal);
		panelWeight.add(textFieldWeight);		
		panelWeight.add(labelWeight);
		panelPopulation.add(comboBoxPopulation);
		panelPopulation.add(labelPopulation);
	}
	else
	{
		panelSize1.add(labelSize1);
		panelSize1.add(textFieldSize1);		
		panelSize2.add(labelSize2);
		panelSize2.add(textFieldSize2);		
		panelSizeTotal.add(labelSizeTotal);
		panelSizeTotal.add(textFieldTotal);		
		panelWeight.add(labelWeight);
		panelWeight.add(textFieldWeight);		
		panelPopulation.add(labelPopulation);
		panelPopulation.add(comboBoxPopulation);
	}
	
	inputLabels.add(labelSize1);
	inputLabels.add(labelSize2);
	inputLabels.add(labelSizeTotal);
	inputLabels.add(labelWeight);
	inputLabels.add(labelPopulation);

	JPanel toadDataPanel = new JPanel();
	toadDataPanel.setLayout(new BoxLayout(toadDataPanel, BoxLayout.Y_AXIS));
	toadDataPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(Color.black, 1), Locale.labelToadData));
	
	toadDataPanel.add(panelPopulation);
	toadDataPanel.add(panelSize1);
	toadDataPanel.add(panelSize2);
	toadDataPanel.add(panelSizeTotal);
	toadDataPanel.add(panelWeight);
	JPanel placeholder = new JPanel();
	toadDataPanel.add(placeholder);
	
	
	dataPanel.add(toadDataPanel);
	
}
 
开发者ID:fossasia,项目名称:zooracle,代码行数:78,代码来源:ToadDataPanel.java

示例14: TableEditor

import javax.swing.JTextField; //导入方法依赖的package包/类
public TableEditor(TablesManagerWindow aTablesManager, Table aTable, TableEditorMode aMode) {
	table = aTable;
	tablesManagerParent = aTablesManager;
	mode = aMode;
	schemaHasChanged = false;
	
	mainContainer = new JPanel();
	centerPanel = new JPanel();
	attrListPanel = new JPanel();
	attrEditorPanel = new JPanel();
	
	tableName = new JTextField();
	newAttrName = new JTextField();
	newAttrType = new JComboBox<DataType>(DataType.values());
	attrList = new JList<Attribute>();
	defaultListModel = new DefaultListModel<Attribute>();
	attrList.setModel(defaultListModel);
	attrList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
	
	tableOriginalName = aTable.getName();
	
	newAttrName.setPreferredSize(new Dimension(TEXTFIELD_WIDTH, TEXTFIELD_HEIGHT));
	newAttrType.setPreferredSize(new Dimension(TEXTFIELD_WIDTH, TEXTFIELD_HEIGHT));
	
	addAttrButton = new JButton("ADD");
	eraseAttrButton = new JButton("ERASE");
	okButton = new JButton("OK");
	
	setLayout(new BorderLayout());
	
	JPanel tableNamePanel = new JPanel(new BorderLayout());
	tableNamePanel.add(new JLabel("Table name: "), BorderLayout.WEST);
	tableNamePanel.add(tableName, BorderLayout.CENTER);
	
	buildAttrListPanel();
	buildAttrEditorPanel();
	
	centerPanel.setLayout(new FlowLayout(FlowLayout.CENTER));
	centerPanel.add(attrListPanel, BorderLayout.WEST);
	centerPanel.add(new JLabel(" << "), BorderLayout.CENTER);
	centerPanel.add(attrEditorPanel, BorderLayout.EAST);
	
	mainContainer.setLayout(new BorderLayout());
	mainContainer.add(tableNamePanel, BorderLayout.NORTH);
	mainContainer.add(centerPanel, BorderLayout.CENTER);
	addPaddingToMainContainer();
	add(mainContainer, BorderLayout.CENTER);
	
	JPanel okButtonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
	okButtonPanel.add(okButton);
	mainContainer.add(okButtonPanel, BorderLayout.SOUTH);
	
	// Add some padding
	centerPanel.setBorder(new EmptyBorder(CENTER_TOP_PADDING,
			CENTER_LEFT_PADDING, CENTER_BOTTOM_PADDING, CENTER_RIGHT_PADDING));
	
	buildOkButton();
	buildWindow();
	setCreationModeConfiguration();
	setModificationModeConfiguration();
	
	pack();
}
 
开发者ID:tteguayco,项目名称:JITRAX,代码行数:64,代码来源:TableEditor.java

示例15: DBMSConnectionWindow

import javax.swing.JTextField; //导入方法依赖的package包/类
public DBMSConnectionWindow(JFrame owner) {
	super(owner);
	
	dbmsList = new JComboBox<String>(DBMS_LIST);
	hostname = new JTextField();
	port = new JTextField();
	username = new JTextField();
	password = new JPasswordField();
	nextButton = new JButton("✔ Next");
	
	hostname.setText(DEFAULT_HOSTNAME);
	port.setText(DEFAULT_PORT);
	username.setText(DEFAULT_USERNAME);
	password.setText(DEFAULT_PASSWORD);
	
	dbmsList.setPreferredSize(new Dimension(TEXTFIELD_WIDTH, TEXTFIELD_HEIGHT));
	hostname.setPreferredSize(new Dimension(TEXTFIELD_WIDTH, TEXTFIELD_HEIGHT));
	port.setPreferredSize(new Dimension(TEXTFIELD_WIDTH, TEXTFIELD_HEIGHT));
	username.setPreferredSize(new Dimension(TEXTFIELD_WIDTH, TEXTFIELD_HEIGHT));
	password.setPreferredSize(new Dimension(TEXTFIELD_WIDTH, TEXTFIELD_HEIGHT));
	
	JPanel mainContainer = new JPanel();
	mainContainer.setLayout(new BoxLayout(mainContainer, BoxLayout.Y_AXIS));
	mainContainer.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
	
	JPanel dbmsPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
	dbmsPanel.add(new JLabel("DBMS: "));
	dbmsPanel.add(dbmsList);
	
	JPanel hostnamePanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
	hostnamePanel.add(new JLabel("Hostname: "));
	hostnamePanel.add(hostname);
	
	JPanel portPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
	portPanel.add(new JLabel("Port: "));
	portPanel.add(port);
	
	JPanel usernamePanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
	usernamePanel.add(new JLabel("Username: "));
	usernamePanel.add(username);
	
	JPanel passwordPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
	passwordPanel.add(new JLabel("Password: "));
	passwordPanel.add(password);
	
	JPanel buttonsPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
	buttonsPanel.add(nextButton);
	
	mainContainer.add(dbmsPanel);
	mainContainer.add(hostnamePanel);
	mainContainer.add(portPanel);
	mainContainer.add(usernamePanel);
	mainContainer.add(passwordPanel);
	mainContainer.add(buttonsPanel);
	add(mainContainer);
	
	buildWindow();
	pack();
}
 
开发者ID:tteguayco,项目名称:JITRAX,代码行数:60,代码来源:DBMSConnectionWindow.java


注:本文中的javax.swing.JTextField.setPreferredSize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。