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


Java JTextField.setEditable方法代码示例

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


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

示例1: displayExportFile

import javax.swing.JTextField; //导入方法依赖的package包/类
@Override
public void displayExportFile() {
	JTextField displayVal = new JTextField(filename);
	displayVal.setEditable(false);
	
	JPanel displayPanel = new JPanel();
	displayPanel.setLayout(new BoxLayout(displayPanel, BoxLayout.Y_AXIS)); //vertically align
	displayPanel.add(new JLabel("Export Filename"));
	displayPanel.add(displayVal);
	displayPanel.setPreferredSize(new Dimension(400,40)); //resize appropriately
	
	final int displayDialog = JOptionPane.showConfirmDialog(null, displayPanel, 
			friendlyName() + " Display", JOptionPane.OK_CANCEL_OPTION,
			JOptionPane.PLAIN_MESSAGE);
	if (displayDialog == JOptionPane.OK_OPTION) {
		//do nothing
	}
}
 
开发者ID:SERESLab,项目名称:iTrace-Archive,代码行数:19,代码来源:XMLGazeExportSolver.java

示例2: init

import javax.swing.JTextField; //导入方法依赖的package包/类
/**
* 
* @Title: init 
* @Description: Component Initialization 
* @param
* @return void 
* @throws
 */
private void init()
{
    this.setLayout(new BorderLayout(FormatConst.BORDER_WIDTH, FormatConst.BORDER_WIDTH));
    this.setBorder(BorderFactory.createEmptyBorder(FormatConst.BORDER_WIDTH, FormatConst.BORDER_WIDTH, FormatConst.BORDER_WIDTH, FormatConst.BORDER_WIDTH));

    pnlTxt = new FormatTxtPanel();

    txtFldStat = new JTextField(FormatConst.FIELD_SIZE);
    txtFldStat.setEditable(false);

    this.add(pnlTxt, BorderLayout.CENTER);
    this.add(txtFldStat, BorderLayout.SOUTH);

    this.setBorder(BorderFactory.createTitledBorder(null, FormatConst.FORMATTER, TitledBorder.CENTER, TitledBorder.DEFAULT_POSITION));
}
 
开发者ID:wisdomtool,项目名称:formatter,代码行数:24,代码来源:FormatView.java

示例3: initPanel2

import javax.swing.JTextField; //导入方法依赖的package包/类
private void initPanel2(){
    panel2 = new JPanel();
    panel2.setLayout(new GridLayout(2,1));
    
    testo = new JTextField();
    testo.setVisible(true);
    testo.setEditable(false);
    int soldi = parcheggio.getCassa().getAmmount();
    if (soldi==0) {
        testo.setText("Non ci sono soldi nella cassa.");
    }
    else {
        testo.setText("Ci sono "+soldi+"Euro nella cassa");
    }
    
    JButton bottone = new JButton("Ritira denaro");
    bottone.addActionListener(new ActionListener(){
        @Override
        public void actionPerformed(ActionEvent e) {
            int tmp = parcheggio.getCassa().ritira();
            if (tmp==0) {
                testo.setText("Non ci sono soldi nella cassa");
            }
            else {
                testo.setText("Sono stati ritirati "+tmp+"Euro");
            }
        }
    });
    panel2.add(bottone);
    panel2.add(testo);
    this.add(panel2,BorderLayout.NORTH);
}
 
开发者ID:IngSW-unipv,项目名称:Progetto-E,代码行数:33,代码来源:GUIOperatore.java

示例4: TicTacToeClient

import javax.swing.JTextField; //导入方法依赖的package包/类
public TicTacToeClient(String host)
{ 
   ticTacToeHost = host; // set name of server
   displayArea = new JTextArea(4, 30); // set up JTextArea
   displayArea.setEditable(false);
   add(new JScrollPane(displayArea), BorderLayout.SOUTH);

   boardPanel = new JPanel(); // set up panel for squares in board
   boardPanel.setLayout(new GridLayout(3, 3, 0, 0));

   board = new Square[3][3]; // create board

   // loop over the rows in the board
   for (int row = 0; row < board.length; row++) 
   {
      // loop over the columns in the board
      for (int column = 0; column < board[row].length; column++) 
      {
         // create square
         board[row][column] = new Square(" ", row * 3 + column);
         boardPanel.add(board[row][column]); // add square       
      }
   } 

   idField = new JTextField(); // set up textfield
   idField.setEditable(false);
   add(idField, BorderLayout.NORTH);
   
   panel2 = new JPanel(); // set up panel to contain boardPanel
   panel2.add(boardPanel, BorderLayout.CENTER); // add board panel
   add(panel2, BorderLayout.CENTER); // add container panel

   setSize(300, 225); // set size of window
   setVisible(true); // show window

   startClient();
}
 
开发者ID:cleitonferreira,项目名称:LivroJavaComoProgramar10Edicao,代码行数:38,代码来源:TicTacToeClient.java

示例5: createTextField

import javax.swing.JTextField; //导入方法依赖的package包/类
/** Create a test field. */
private JTextField createTextField(int width) {
    JTextField f = new JTextField(width);
    f.setEditable(false);
    f.setBorder(null);
    return f;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:8,代码来源:CheckAttributedTree.java

示例6: AccountTransferDialog

import javax.swing.JTextField; //导入方法依赖的package包/类
/**
 * Set up and show the dialog. The first Component argument determines which
 * frame the dialog depends on; it should be a component in the dialog's
 * controlling frame. The second Component argument should be null if you
 * want the dialog to come up with its left corner in the center of the
 * screen; otherwise, it should be the component on top of which the dialog
 * should appear.
 */

public AccountTransferDialog(Component frameComp, Component locationComp,
		String title,  Object[] brokers,I_TickerManager tickerManager) {
	super(frameComp, locationComp, title, tickerManager);

	
	brokerList = new JComboBox(brokers);
	brokerList.setEditable(true);
	brokerList.setSelectedIndex(0);
	
	newBrokerField = new JTextField(FIELD_LEN);
	newBrokerField.setEditable(true);
	newBrokerField.setText("");		
	newBrokerField.addKeyListener(this);
	
	dateFieldLabel = new JLabel("Siirtopäivä: ");
	dateFieldLabel.setLabelFor(dateChooser);
	
	brokerFieldLabel = new JLabel("Vanha välittäjä: ");
	brokerFieldLabel.setLabelFor(brokerList);
	
	newBrokerFieldLabel = new JLabel("Uusi välittäjä: ");
	newBrokerFieldLabel.setLabelFor(newBrokerField);
	
	init(getDialogLabels(), getDialogComponents());
}
 
开发者ID:skarna1,项目名称:javaportfolio,代码行数:35,代码来源:AccountTransferDialog.java

示例7: TextFieldFrame

import javax.swing.JTextField; //导入方法依赖的package包/类
public TextFieldFrame()
{
   super("Testing JTextField and JPasswordField");
   setLayout(new FlowLayout());

   // construct textfield with 10 columns
   textField1 = new JTextField(10); 
   add(textField1); // add textField1 to JFrame

   // construct textfield with default text
   textField2 = new JTextField("Enter text here");
   add(textField2); // add textField2 to JFrame

   // construct textfield with default text and 21 columns
   textField3 = new JTextField("Uneditable text field", 21);
   textField3.setEditable(false); // disable editing
   add(textField3); // add textField3 to JFrame

   // construct passwordfield with default text
   passwordField = new JPasswordField("Hidden text");
   add(passwordField); // add passwordField to JFrame

   // register event handlers
   TextFieldHandler handler = new TextFieldHandler();
   textField1.addActionListener(handler);
   textField2.addActionListener(handler);
   textField3.addActionListener(handler);
   passwordField.addActionListener(handler);
}
 
开发者ID:cleitonferreira,项目名称:LivroJavaComoProgramar10Edicao,代码行数:30,代码来源:TextFieldFrame.java

示例8: addAdditionalControls

import javax.swing.JTextField; //导入方法依赖的package包/类
protected void addAdditionalControls(JComponent c, boolean enabled) {
  serverName.setEditable(enabled);
  c.add(new JLabel(Resources.getString("ServerAddressBook.server_name"))); //$NON-NLS-1$
  c.add(serverName, "wrap, growx, push"); //$NON-NLS-1$

  serverIp.setEditable(enabled);
  c.add(new JLabel(Resources.getString("ServerAddressBook.server_ip"))); //$NON-NLS-1$
  c.add(serverIp, "wrap, growx, push"); //$NON-NLS-1$

  serverPort.setEditable(enabled);
  c.add(new JLabel(Resources.getString("ServerAddressBook.server_port"))); //$NON-NLS-1$
  c.add(serverPort, "wrap, growx, push"); //$NON-NLS-1$

  listenPort.setEditable(enabled);
  c.add(new JLabel(Resources.getString("ServerAddressBook.invite_port"))); //$NON-NLS-1$
  c.add(listenPort, "wrap, growx, push"); //$NON-NLS-1$

  c.add(new JLabel(Resources.getString("Peer2Peer.internet_address"))); //$NON-NLS-1$
  final JTextField externalIP = new JTextField(getExternalAddress());
  externalIP.setEditable(false);
  c.add(externalIP, "wrap, growx, push"); //$NON-NLS-1$

  if (!getLocalAddress().equals(getExternalAddress())) {
    c.add(new JLabel(Resources.getString("Peer2Peer.local_address"))); //$NON-NLS-1$
    final JTextField localIP = new JTextField(getLocalAddress());
    localIP.setEditable(false);
    c.add(localIP, "wrap, growx, push"); //$NON-NLS-1$
  }
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:30,代码来源:ServerAddressBook.java

示例9: initProperties

import javax.swing.JTextField; //导入方法依赖的package包/类
@Override
protected void initProperties() {
    setTitle("Friend area editor");
    
    // Initialize the components
    lblName = new JLabel("Name");
    lblNamePointer = new JLabel("Name pointer");
    lblCount = new JLabel("No. of Pokémon");
    lblCondition = new JLabel("Unlock condition");
    lblPrice = new JLabel("Price");
    txtName = new JTextField("00000000");
    txtName.setEditable(false);
    txtNamePointer = new JTextField();
    txtNamePointer.setEditable(false);
    spnCount = new JSpinner();
    spnCount.setModel(new SpinnerNumberModel(0, 0, 15, 1));
    cmoCondition = new JComboBox();
    cmoCondition.setModel(new DefaultComboBoxModel(new String[] { "0x0: Shop (Story-game)", "0x1: Shop (Post-game)", "0x2: Wonder mail event", "0x3: Legendary request" }));
    spnPrice = new JSpinner();
    spnPrice.setModel(new SpinnerNumberModel(Long.valueOf(0L), Long.valueOf(0L), Long.valueOf(99999L), Long.valueOf(1L)));
    
    // Add the components to the property panel
    properties.addCaption("Area settings");
    properties.addLabeledComponent(lblName, txtName);
    properties.addLabeledComponent(lblNamePointer, txtNamePointer);
    properties.addLabeledComponent(lblCount, spnCount);
    properties.addLabeledComponent(lblCondition, cmoCondition);
    properties.addLabeledComponent(lblPrice, spnPrice);
    properties.addTerminator();
}
 
开发者ID:SunakazeKun,项目名称:PMDe,代码行数:31,代码来源:AreaEditor.java

示例10: setupGui

import javax.swing.JTextField; //导入方法依赖的package包/类
private void setupGui()
{
	JLabel identifierLabel = new JLabel(
			CurrentLocale.get("com.tle.admin.usermanagement.internal.userdetailspanel.identifier")); //$NON-NLS-1$
	JLabel usernameLabel = new JLabel(
			CurrentLocale.get("com.tle.admin.usermanagement.internal.userdetailspanel.username")); //$NON-NLS-1$
	JLabel firstNameLabel = new JLabel(
			CurrentLocale.get("com.tle.admin.usermanagement.internal.userdetailspanel.first")); //$NON-NLS-1$
	JLabel lastNameLabel = new JLabel(
			CurrentLocale.get("com.tle.admin.usermanagement.internal.userdetailspanel.last")); //$NON-NLS-1$
	JLabel emailAddressLabel = new JLabel(
			CurrentLocale.get("com.tle.admin.usermanagement.internal.userdetailspanel.email")); //$NON-NLS-1$
	JLabel newPasswordLabel = new JLabel(
			CurrentLocale.get("com.tle.admin.usermanagement.internal.userdetailspanel.newpswd")); //$NON-NLS-1$
	JLabel passwordConfirmLabel = new JLabel(
			CurrentLocale.get("com.tle.admin.usermanagement.internal.userdetailspanel.confirmpswd")); //$NON-NLS-1$

	identifier = new JTextField();
	identifier.setEditable(false);
	username = new JTextField();
	firstName = new JTextField();
	lastName = new JTextField();
	emailAddress = new JTextField();
	newPassword = new JPasswordField();
	passwordConfirm = new JPasswordField();

	labels.put("username", usernameLabel);
	labels.put("firstName", firstNameLabel);
	labels.put("lastName", lastNameLabel);
	labels.put("emailAddress", emailAddressLabel);
	labels.put("email", emailAddressLabel);
	labels.put("password", newPasswordLabel);

	JButton save = new JButton(saveAction);

	final int height1 = username.getPreferredSize().height;
	final int height2 = save.getPreferredSize().height;
	final int width1 = passwordConfirmLabel.getPreferredSize().width + 10;
	final int width2 = save.getPreferredSize().width;

	final int[] rows = {height1, height1, height1, height1, height1, height1, height1, height1, TableLayout.FILL,
			height2,};
	final int[] cols = {width1, TableLayout.FILL, width2,};

	setLayout(new TableLayout(rows, cols));
	add(identifierLabel, new Rectangle(0, 0, 1, 1));
	add(identifier, new Rectangle(1, 0, 2, 1));
	add(usernameLabel, new Rectangle(0, 1, 1, 1));
	add(username, new Rectangle(1, 1, 2, 1));
	add(firstNameLabel, new Rectangle(0, 2, 1, 1));
	add(firstName, new Rectangle(1, 2, 2, 1));
	add(lastNameLabel, new Rectangle(0, 3, 1, 1));
	add(lastName, new Rectangle(1, 3, 2, 1));
	add(emailAddressLabel, new Rectangle(0, 4, 1, 1));
	add(emailAddress, new Rectangle(1, 4, 2, 1));

	add(newPasswordLabel, new Rectangle(0, 6, 1, 1));
	add(newPassword, new Rectangle(1, 6, 2, 1));

	add(passwordConfirmLabel, new Rectangle(0, 7, 1, 1));
	add(passwordConfirm, new Rectangle(1, 7, 2, 1));

	add(save, new Rectangle(2, 9, 1, 1));

	changeDetector = new ChangeDetector();
	changeDetector.watch(username);
	changeDetector.watch(firstName);
	changeDetector.watch(lastName);
	changeDetector.watch(emailAddress);
	changeDetector.watch(newPassword);
	changeDetector.watch(passwordConfirm);
}
 
开发者ID:equella,项目名称:Equella,代码行数:73,代码来源:UserDetailsPanel.java

示例11: GestionUsuarios

import javax.swing.JTextField; //导入方法依赖的package包/类
public GestionUsuarios(Connection conn,JFrame principal) {
	super();
	this.conn=conn;		// Recibimos la conexi�n de Biblioteca
	this.principal=principal;
	this.principal.setEnabled(false);
	this.principal.setVisible(false);
	setTitle("Gesti�n de usuarios");
	
	txtApellido1 = new JTextField();
	txtApellido1.setEditable(false);
	txtApellido1.setHorizontalAlignment(SwingConstants.CENTER);
	txtApellido1.setBounds(14, 78, 110, 20);
	getContentPane().add(txtApellido1);
	txtApellido1.setColumns(10);
	
	txtApellido2 = new JTextField();
	txtApellido2.setEditable(false);
	txtApellido2.setHorizontalAlignment(SwingConstants.CENTER);
	txtApellido2.setBounds(138, 78, 110, 20);
	getContentPane().add(txtApellido2);
	txtApellido2.setColumns(10);
	
	txtNombre = new JTextField();
	txtNombre.setEditable(false);
	txtNombre.setHorizontalAlignment(SwingConstants.CENTER);
	txtNombre.setBounds(262, 78, 110, 20);
	getContentPane().add(txtNombre);
	txtNombre.setColumns(10);
	
	JLabel lblApellido = new JLabel("Apellido 1");
	lblApellido.setHorizontalAlignment(SwingConstants.CENTER);
	lblApellido.setBounds(41, 53, 56, 14);
	getContentPane().add(lblApellido);
	
	JLabel lblApellido_1 = new JLabel("Apellido 2");
	lblApellido_1.setHorizontalAlignment(SwingConstants.CENTER);
	lblApellido_1.setBounds(165, 53, 56, 14);
	getContentPane().add(lblApellido_1);
	
	JLabel lblNombre = new JLabel("Nombre");
	lblNombre.setHorizontalAlignment(SwingConstants.CENTER);
	lblNombre.setBounds(289, 53, 56, 14);
	getContentPane().add(lblNombre);
	
	txtCodigoUser = new JTextField();
	txtCodigoUser.setEditable(false);
	txtCodigoUser.setHorizontalAlignment(SwingConstants.CENTER);
	txtCodigoUser.setBounds(153, 136, 86, 20);
	getContentPane().add(txtCodigoUser);
	txtCodigoUser.setColumns(10);
	
	lblCodigo = new JLabel("Codigo");
	lblCodigo.setHorizontalAlignment(SwingConstants.CENTER);
	lblCodigo.setBounds(173, 111, 46, 14);
	getContentPane().add(lblCodigo);
	
	lblGestinDeUsuario = new JLabel("Gesti\u00F3n de usuario");
	lblGestinDeUsuario.setHorizontalAlignment(SwingConstants.CENTER);
	lblGestinDeUsuario.setForeground(Color.BLUE);
	lblGestinDeUsuario.setBounds(137, 11, 111, 14);
	getContentPane().add(lblGestinDeUsuario);
}
 
开发者ID:JuandeLS3,项目名称:Library-app,代码行数:63,代码来源:GestionUsuarios.java

示例12: GestionArticulos

import javax.swing.JTextField; //导入方法依赖的package包/类
public GestionArticulos(Connection conn,JFrame principal) {
	super();
	this.conn=conn;		// Recibimos la conexi�n de Biblioteca
	this.principal=principal;
	this.principal.setEnabled(false);
	this.principal.setVisible(false);
	setTitle("Gesti�n de art�culos");
	
	txtCodigo = new JTextField();
	txtCodigo.setHorizontalAlignment(SwingConstants.CENTER);
	txtCodigo.setEditable(false);
	txtCodigo.setBounds(59, 68, 105, 20);
	getContentPane().add(txtCodigo);
	txtCodigo.setColumns(10);
	
	txtTitulo = new JTextField();
	txtTitulo.setHorizontalAlignment(SwingConstants.CENTER);
	txtTitulo.setEditable(false);
	txtTitulo.setBounds(223, 68, 105, 20);
	getContentPane().add(txtTitulo);
	txtTitulo.setColumns(10);
	
	txtAutor = new JTextField();
	txtAutor.setHorizontalAlignment(SwingConstants.CENTER);
	txtAutor.setEditable(false);
	txtAutor.setBounds(59, 131, 105, 20);
	getContentPane().add(txtAutor);
	txtAutor.setColumns(10);
	
	txtNumpaginas = new JTextField();
	txtNumpaginas.setHorizontalAlignment(SwingConstants.CENTER);
	txtNumpaginas.setEditable(false);
	txtNumpaginas.setBounds(223, 131, 105, 20);
	getContentPane().add(txtNumpaginas);
	txtNumpaginas.setColumns(10);
	
	JLabel lblCdigo = new JLabel("C\u00F3digo");
	lblCdigo.setHorizontalAlignment(SwingConstants.CENTER);
	lblCdigo.setBounds(88, 43, 46, 14);
	getContentPane().add(lblCdigo);
	
	JLabel lblTitulo = new JLabel("Titulo");
	lblTitulo.setHorizontalAlignment(SwingConstants.CENTER);
	lblTitulo.setBounds(252, 43, 46, 14);
	getContentPane().add(lblTitulo);
	
	JLabel lblAutor = new JLabel("Autor");
	lblAutor.setHorizontalAlignment(SwingConstants.CENTER);
	lblAutor.setBounds(88, 106, 46, 14);
	getContentPane().add(lblAutor);
	
	JLabel lblNumPginas = new JLabel("Num. p\u00E1ginas");
	lblNumPginas.setHorizontalAlignment(SwingConstants.CENTER);
	lblNumPginas.setBounds(228, 106, 95, 14);
	getContentPane().add(lblNumPginas);
	
	JLabel lblGestinDeArtculos = new JLabel("Gesti\u00F3n de art\u00EDculos");
	lblGestinDeArtculos.setForeground(Color.BLUE);
	lblGestinDeArtculos.setHorizontalAlignment(SwingConstants.CENTER);
	lblGestinDeArtculos.setBounds(141, 11, 117, 14);
	getContentPane().add(lblGestinDeArtculos);
	

}
 
开发者ID:JuandeLS3,项目名称:Library-app,代码行数:65,代码来源:GestionArticulos.java

示例13: NuevoPrestamo

import javax.swing.JTextField; //导入方法依赖的package包/类
/**
 * @wbp.parser.constructor
 */
public NuevoPrestamo(Connection conn,JFrameJTable principal,String nombreuser,int codusuario,int codigoproducto,char tipochooser,String fecha) {
	setIconImage(Toolkit.getDefaultToolkit().getImage(NuevoPrestamo.class.getResource("/biblioteca/images/book.png")));
	setTitle("Modificar pr�stamo");
	this.principal=principal;
	this.conn=conn;
	initComponents();
	
	btnBuscarUsuario.setEnabled(false);
	btnBuscarCodigo.setEnabled(false);
	txtUsuario.setText(nombreuser);
	txtCodigo.setText(""+codigoproducto);
	PKuser=""+codusuario;
	PKproducto=""+codigoproducto;

	switch (tipochooser) {
	case 'L':
		tipo.select("Libro");
		break;
	case 'R':
		tipo.select("Revista");
		break;
	case 'C':
		tipo.select("CDROM");
		break;
	case 'A':
		tipo.select("Articulo");
		break;
	default:
		break;
	}


	fecha_devol = new JDateChooser();
	fecha_devol.setEnabled(false);
	fecha_devol.setBounds(265, 208, 126, 23);
	contentPane.add(fecha_devol);
	fecha_devol.setEnabled(true);
	
	JLabel lblfecha_prestDevol = new JLabel("Fecha de devoluci\u00F3n");
	lblfecha_prestDevol.setBounds(265, 193, 148, 14);
	contentPane.add(lblfecha_prestDevol);
	
	txtFecha_prest = new JTextField();
	txtFecha_prest.setEditable(false);
	txtFecha_prest.setBounds(16, 208, 126, 23);
	contentPane.add(txtFecha_prest);
	txtFecha_prest.setColumns(10);
	txtFecha_prest.setText(fecha);
	
	btnActualizar = new JButton("Actualizar");
	btnActualizar.setBounds(157, 264, 98, 23);
	contentPane.add(btnActualizar);
	btnActualizar.addActionListener(this);
	
	
	setVisible(true);
}
 
开发者ID:JuandeLS3,项目名称:Library-app,代码行数:61,代码来源:NuevoPrestamo.java

示例14: 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

示例15: doComboBoxAction

import javax.swing.JTextField; //导入方法依赖的package包/类
@Override
protected void doComboBoxAction() {
	if (comboBox.getSelectedIndex() > 0) {
		// get params of the selected resource type
		paramNames = new ArrayList<String>();
		paramValues = new ArrayList<JTextField>();
		AbstractConstraint selectedCons = ((ComboBoxConstraint) comboBox
				.getSelectedItem()).getConstraint();
		for (final Method m : selectedCons.getClass().getDeclaredMethods()) {
			if (m.isAnnotationPresent(ExchangeParameter.class)
					&& m.getName().startsWith("set")) {
				// For every setter method get the name of the parameter to
				// set and display it as a label along with a text field for
				// setting the value.
				String name = m.getName().substring(3).toLowerCase();
				paramNames.add(name);
				JLabel paramName = new JLabel(name.replaceFirst("demanded",
						"demanded "));
				paramName.setVisible(true);
				paramsPanel.add(paramName);
				JTextField paramValue = new JTextField(3);
				try {
					paramValue
							.setText(selectedCons
									.getClass()
									.getMethod(
											"get"
													+ m.getName()
															.substring(3),
											new Class<?>[0])
									.invoke(selectedCons, new Object[0])
									.toString());
				} catch (Exception e) {
					e.printStackTrace();
					throw new AssertionError(
							"Error occurred while trying to access a get Metdod of the Object "
									+ entity);
				}
				paramValue.setEditable(true);
				paramValue.setVisible(true);
				paramValues.add(paramValue);
				paramsPanel.add(paramValue);
				paramValue.requestFocus();
			}
		}
	}
}
 
开发者ID:KeepTheBeats,项目名称:alevin-svn2,代码行数:48,代码来源:EditConstraintDialog.java


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