List of usage examples for javax.swing SwingConstants RIGHT
int RIGHT
To view the source code for javax.swing SwingConstants RIGHT.
Click Source Link
From source file:com.pos.spatobiz.app.view.karyawan.HapusKaryawan.java
/** This method is called from within the constructor to * initialize the form./*from www. j a v a2s .c o m*/ * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jeniskelamin = new ButtonGroup(); labelKode = new WhiteLabel(); labelNama = new WhiteLabel(); labelTanggalLahir = new WhiteLabel(); labelAlamat = new WhiteLabel(); textKode = new TextBoxTransfer(); textNama = new TextBoxTransfer(); textTanggalLahir = new DateBox(); textAlamat = new WhiteTextArea(); textTelepon = new TextBoxTransfer(); labelTelepon = new WhiteLabel(); labelEmail = new WhiteLabel(); labelJenisKelamin = new WhiteLabel(); labelPhoto = new WhiteLabel(); textEmail = new TextBoxTransfer(); radioPria = new JRadioButton(); radioWanita = new JRadioButton(); imageChooser = new ImageChooser(); buttonBatal = new Button(); buttonHapus = new Button(); buttonCari = new Button(); setBackground(new Color(0, 0, 0)); labelKode.setHorizontalAlignment(SwingConstants.RIGHT); labelKode.setText("Kode :"); labelNama.setHorizontalAlignment(SwingConstants.RIGHT); labelNama.setText("Nama :"); labelTanggalLahir.setHorizontalAlignment(SwingConstants.RIGHT); labelTanggalLahir.setText("Tanggal Lahir :"); labelAlamat.setHorizontalAlignment(SwingConstants.RIGHT); labelAlamat.setText("Alamat :"); textNama.setEnabled(false); textTanggalLahir.setEnabled(false); textTanggalLahir.setFormatterFactory( new DefaultFormatterFactory(new DateFormatter(DateFormat.getDateInstance(DateFormat.LONG)))); textTanggalLahir.setPreferredSize(new Dimension(120, 24)); textTanggalLahir.setValue(new Date()); textAlamat.setEnabled(false); textTelepon.setEnabled(false); labelTelepon.setHorizontalAlignment(SwingConstants.RIGHT); labelTelepon.setText("Telepon :"); labelEmail.setHorizontalAlignment(SwingConstants.RIGHT); labelEmail.setText("Email :"); labelJenisKelamin.setHorizontalAlignment(SwingConstants.RIGHT); labelJenisKelamin.setText("Jenis Kelamin :"); labelPhoto.setHorizontalAlignment(SwingConstants.RIGHT); labelPhoto.setText("Photo :"); textEmail.setEnabled(false); jeniskelamin.add(radioPria); radioPria.setFont(new Font("Tahoma", 1, 11)); radioPria.setForeground(new Color(255, 255, 255)); radioPria.setSelected(true); radioPria.setText("Pria"); radioPria.setEnabled(false); radioPria.setOpaque(false); jeniskelamin.add(radioWanita); radioWanita.setFont(new Font("Tahoma", 1, 11)); radioWanita.setForeground(new Color(255, 255, 255)); radioWanita.setText("Wanita"); radioWanita.setEnabled(false); radioWanita.setOpaque(false); imageChooser.setEnabled(false); buttonBatal.setMnemonic('B'); buttonBatal.setText("Batal"); buttonHapus.setMnemonic('H'); buttonHapus.setText("Hapus"); buttonCari.setText("Cari"); GroupLayout layout = new GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(Alignment.LEADING) .addGroup( Alignment.TRAILING, layout .createSequentialGroup().addContainerGap().addGroup(layout .createParallelGroup(Alignment.TRAILING).addGroup(layout .createSequentialGroup().addComponent( buttonHapus, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED).addComponent( buttonBatal, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addGroup(layout.createSequentialGroup().addGroup(layout .createParallelGroup(Alignment.LEADING).addGroup(layout .createParallelGroup(Alignment.TRAILING, false) .addComponent(labelPhoto, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(labelJenisKelamin, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent( labelEmail, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGroup(layout .createParallelGroup(Alignment.TRAILING, false) .addComponent(labelTelepon, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(labelTanggalLahir, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(labelAlamat, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(labelNama, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent( labelKode, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(Alignment.TRAILING) .addComponent(textAlamat, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(textNama, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 552, Short.MAX_VALUE) .addComponent(textTanggalLahir, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 552, Short.MAX_VALUE) .addComponent(textTelepon, GroupLayout.DEFAULT_SIZE, 552, Short.MAX_VALUE) .addGroup(Alignment.LEADING, layout .createSequentialGroup() .addComponent(radioPria) .addPreferredGap( ComponentPlacement.UNRELATED) .addComponent(radioWanita)) .addComponent( imageChooser, Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 253, GroupLayout.PREFERRED_SIZE) .addComponent(textEmail, GroupLayout.DEFAULT_SIZE, 552, Short.MAX_VALUE) .addGroup(layout.createSequentialGroup() .addComponent(textKode, GroupLayout.DEFAULT_SIZE, 488, Short.MAX_VALUE) .addPreferredGap( ComponentPlacement.UNRELATED) .addComponent(buttonCari, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))))) .addContainerGap())); layout.setVerticalGroup(layout.createParallelGroup(Alignment.LEADING).addGroup(layout .createSequentialGroup().addContainerGap() .addGroup(layout.createParallelGroup(Alignment.BASELINE) .addComponent(labelKode, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(textKode, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(buttonCari, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(Alignment.BASELINE) .addComponent(labelNama, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(textNama, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(Alignment.BASELINE) .addComponent(labelTanggalLahir, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(textTanggalLahir, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(Alignment.LEADING) .addComponent(labelAlamat, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(textAlamat, GroupLayout.PREFERRED_SIZE, 88, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(Alignment.BASELINE) .addComponent(textTelepon, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(labelTelepon, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(Alignment.BASELINE) .addComponent(labelEmail, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(textEmail, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(Alignment.BASELINE) .addComponent(labelJenisKelamin, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(radioPria).addComponent(radioWanita)) .addPreferredGap(ComponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(Alignment.LEADING) .addComponent(labelPhoto, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(imageChooser, GroupLayout.PREFERRED_SIZE, 189, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.RELATED, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(layout.createParallelGroup(Alignment.BASELINE) .addComponent(buttonBatal, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(buttonHapus, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addContainerGap())); }
From source file:net.sourceforge.atunes.kernel.controllers.stats.StatsDialogController.java
private void setTable(JTable table, Object[] headers, Object[][] content) { table.setModel(new DefaultTableModel(content, headers)); table.getColumnModel().getColumn(0).setPreferredWidth(420); table.getColumnModel().getColumn(0).setWidth(table.getColumnModel().getColumn(0).getWidth()); table.getColumnModel().getColumn(2).setPreferredWidth(30); table.getColumnModel().getColumn(2).setWidth(table.getColumnModel().getColumn(2).getWidth()); table.getColumnModel().getColumn(1).setCellRenderer(new SubstanceDefaultTableCellRenderer() { public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { JLabel l = (JLabel) super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);//from w w w . j a va 2 s . c om l.setHorizontalAlignment(SwingConstants.RIGHT); return l; } }); table.getColumnModel().getColumn(2).setCellRenderer(new SubstanceDefaultTableCellRenderer() { public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { JLabel l = (JLabel) super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); l.setHorizontalAlignment(SwingConstants.RIGHT); return l; } }); }
From source file:com.pos.spatobiz.app.view.karyawan.TambahKaryawan.java
/** This method is called from within the constructor to * initialize the form./*from w ww . j a v a 2s .com*/ * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jeniskelamin = new ButtonGroup(); labelKode = new WhiteLabel(); labelNama = new WhiteLabel(); labelTanggalLahir = new WhiteLabel(); labelAlamat = new WhiteLabel(); textKode = new TextBoxTransfer(); textNama = new TextBoxTransfer(); textTanggalLahir = new DateBox(); textAlamat = new WhiteTextArea(); errorKode = new RedLabel(); errorNama = new RedLabel(); errorTanggalLahir = new RedLabel(); errorAlamat = new RedLabel(); textTelepon = new TextBoxTransfer(); labelTelepon = new WhiteLabel(); labelEmail = new WhiteLabel(); labelJenisKelamin = new WhiteLabel(); labelPhoto = new WhiteLabel(); textEmail = new TextBoxTransfer(); radioPria = new JRadioButton(); radioWanita = new JRadioButton(); errorTelepon = new RedLabel(); errorEmail = new RedLabel(); imageChooser = new ImageChooser(); buttonBatal = new Button(); buttonTambah = new Button(); setBackground(new Color(0, 0, 0)); labelKode.setHorizontalAlignment(SwingConstants.RIGHT); labelKode.setText("Kode :"); labelNama.setHorizontalAlignment(SwingConstants.RIGHT); labelNama.setText("Nama :"); labelTanggalLahir.setHorizontalAlignment(SwingConstants.RIGHT); labelTanggalLahir.setText("Tanggal Lahir :"); labelAlamat.setHorizontalAlignment(SwingConstants.RIGHT); labelAlamat.setText("Alamat :"); textTanggalLahir.setFormatterFactory( new DefaultFormatterFactory(new DateFormatter(DateFormat.getDateInstance(DateFormat.LONG)))); textTanggalLahir.setPreferredSize(new Dimension(120, 24)); textTanggalLahir.setValue(new Date()); errorKode.setText("error kode"); errorNama.setText("error nama"); errorTanggalLahir.setText("error tanggal lahir"); errorAlamat.setText("error alamat"); labelTelepon.setHorizontalAlignment(SwingConstants.RIGHT); labelTelepon.setText("Telepon :"); labelEmail.setHorizontalAlignment(SwingConstants.RIGHT); labelEmail.setText("Email :"); labelJenisKelamin.setHorizontalAlignment(SwingConstants.RIGHT); labelJenisKelamin.setText("Jenis Kelamin :"); labelPhoto.setHorizontalAlignment(SwingConstants.RIGHT); labelPhoto.setText("Photo :"); jeniskelamin.add(radioPria); radioPria.setFont(new Font("Tahoma", 1, 11)); // NOI18N radioPria.setForeground(new Color(255, 255, 255)); radioPria.setSelected(true); radioPria.setText("Pria"); radioPria.setOpaque(false); jeniskelamin.add(radioWanita); radioWanita.setFont(new Font("Tahoma", 1, 11)); radioWanita.setForeground(new Color(255, 255, 255)); radioWanita.setText("Wanita"); radioWanita.setOpaque(false); errorTelepon.setText("error telepon"); errorEmail.setText("error email"); buttonBatal.setMnemonic('B'); buttonBatal.setText("Batal"); buttonTambah.setMnemonic('T'); buttonTambah.setText("Tambah"); GroupLayout layout = new GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup(layout.createParallelGroup(Alignment.LEADING).addGroup(layout .createSequentialGroup().addContainerGap() .addGroup(layout.createParallelGroup(Alignment.LEADING).addGroup(Alignment.TRAILING, layout.createSequentialGroup().addGroup(layout.createParallelGroup(Alignment.LEADING) .addGroup(layout.createParallelGroup(Alignment.TRAILING, false) .addComponent(labelPhoto, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(labelJenisKelamin, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(labelEmail, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGroup(layout.createParallelGroup(Alignment.TRAILING, false) .addComponent(labelTelepon, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(labelTanggalLahir, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(labelAlamat, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(labelNama, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(labelKode, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(Alignment.TRAILING) .addComponent(textAlamat, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 403, Short.MAX_VALUE) .addComponent(textNama, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 403, Short.MAX_VALUE) .addComponent(textTanggalLahir, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 403, Short.MAX_VALUE) .addComponent(textKode, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 403, Short.MAX_VALUE) .addComponent(textTelepon, GroupLayout.DEFAULT_SIZE, 403, Short.MAX_VALUE) .addGroup(Alignment.LEADING, layout.createSequentialGroup().addComponent(radioPria) .addPreferredGap(ComponentPlacement.UNRELATED) .addComponent(radioWanita)) .addComponent(imageChooser, Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 253, GroupLayout.PREFERRED_SIZE) .addComponent(textEmail, GroupLayout.DEFAULT_SIZE, 403, Short.MAX_VALUE)) .addGap(4, 4, 4) .addGroup(layout.createParallelGroup(Alignment.LEADING) .addComponent(errorKode, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(errorNama, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(errorTanggalLahir, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(errorAlamat, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(errorTelepon, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(errorEmail, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))) .addGroup(Alignment.TRAILING, layout.createSequentialGroup() .addComponent(buttonTambah, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED).addComponent(buttonBatal, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))) .addContainerGap())); layout.setVerticalGroup(layout.createParallelGroup(Alignment.LEADING).addGroup(layout .createSequentialGroup().addContainerGap() .addGroup(layout.createParallelGroup(Alignment.BASELINE) .addComponent(labelKode, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(textKode, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(errorKode, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(Alignment.BASELINE) .addComponent(labelNama, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(textNama, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(errorNama, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(Alignment.BASELINE) .addComponent(labelTanggalLahir, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(textTanggalLahir, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(errorTanggalLahir, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(Alignment.LEADING) .addComponent(labelAlamat, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(textAlamat, GroupLayout.PREFERRED_SIZE, 88, GroupLayout.PREFERRED_SIZE) .addComponent(errorAlamat, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(Alignment.BASELINE) .addComponent(textTelepon, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(labelTelepon, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(errorTelepon, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(Alignment.BASELINE) .addComponent(labelEmail, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(textEmail, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(errorEmail, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(Alignment.BASELINE) .addComponent(labelJenisKelamin, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(radioPria).addComponent(radioWanita)) .addPreferredGap(ComponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(Alignment.LEADING) .addComponent(labelPhoto, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(imageChooser, GroupLayout.PREFERRED_SIZE, 189, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.RELATED, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(layout.createParallelGroup(Alignment.BASELINE) .addComponent(buttonBatal, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(buttonTambah, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addContainerGap())); }
From source file:org.pentaho.support.standalone.SDSupportUtility.java
/** * initializing UI/*w w w. ja v a 2 s . co m*/ * * @throws Exception */ public SDSupportUtility() throws Exception { prop = loadProperty(); setResizable(false); setTitle(SDConstant.PENT_SUP_WIZARD); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 665, 516); contentPane = new JPanel(); contentPane.setBackground(UIManager.getColor("Button.background")); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); contentPane.setLayout(null); JLabel lblLastAttached = new JLabel("Last Attached"); lblLastAttached.setOpaque(false); lblLastAttached.setHorizontalAlignment(SwingConstants.LEFT); lblLastAttached.setBounds(322, 335, 127, 23); contentPane.add(lblLastAttached); JLabel lblPentahoCustomerSupport = new JLabel("Pentaho Customer Support Wizard"); lblPentahoCustomerSupport.setForeground(new Color(51, 51, 51)); lblPentahoCustomerSupport.setVerticalAlignment(SwingConstants.TOP); lblPentahoCustomerSupport.setHorizontalAlignment(SwingConstants.RIGHT); lblPentahoCustomerSupport.setFont(new Font("Tahoma", Font.BOLD, 23)); lblPentahoCustomerSupport.setBounds(130, 109, 506, 37); contentPane.add(lblPentahoCustomerSupport); JLabel lbllogo = new JLabel(); lbllogo.setIcon(new ImageIcon( SDSupportUtility.class.getResource("/org/pentaho/support/standalone/puc-login-logo.png"))); lbllogo.setBounds(10, 11, 409, 93); contentPane.add(lbllogo); chckbxNewCheckBoxEnvironment = new JCheckBox("Environment"); chckbxNewCheckBoxEnvironment.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { ArgList.add(SDConstant.ENVIRONMENT); } else { ArgList.remove(SDConstant.ENVIRONMENT); } } }); chckbxNewCheckBoxEnvironment.setBounds(109, 268, 243, 23); contentPane.add(chckbxNewCheckBoxEnvironment); chckbxNewCheckBoxEnvironment.setOpaque(false); chckbxNewCheckBoxStructure = new JCheckBox("Structure Details"); chckbxNewCheckBoxStructure.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { ArgList.add(SDConstant.STRUCT); } else { ArgList.remove(SDConstant.STRUCT); } } }); chckbxNewCheckBoxStructure.setBounds(377, 190, 248, 23); contentPane.add(chckbxNewCheckBoxStructure); chckbxNewCheckBoxStructure.setOpaque(false); chckbxLogs = new JCheckBox("Logs"); chckbxLogs.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { ArgList.add(SDConstant.LOGS); } else { ArgList.remove(SDConstant.LOGS); } } }); chckbxLogs.setBounds(377, 164, 248, 23); contentPane.add(chckbxLogs); chckbxLogs.setOpaque(false); chckbxGetSecureFiles = new JCheckBox("Secure Files"); chckbxGetSecureFiles.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { ArgList.add(SDConstant.SECURITY); } else { ArgList.remove(SDConstant.SECURITY); } } }); chckbxGetSecureFiles.setBounds(109, 190, 243, 23); contentPane.add(chckbxGetSecureFiles); chckbxGetSecureFiles.setOpaque(false); chckbxMd5 = new JCheckBox("MD5 Hash Value"); chckbxMd5.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { ArgList.add(SDConstant.MD5); } else { ArgList.remove(SDConstant.MD5); } } }); chckbxMd5.setBounds(109, 216, 243, 23); contentPane.add(chckbxMd5); chckbxMd5.setOpaque(false); chckbxDbdetails = new JCheckBox("Datasource Details"); chckbxDbdetails.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { ArgList.add(SDConstant.DATASOURCE); } else { ArgList.remove(SDConstant.DATASOURCE); } } }); chckbxDbdetails.setBounds(109, 294, 243, 23); contentPane.add(chckbxDbdetails); chckbxDbdetails.setOpaque(false); chckbxLicense = new JCheckBox("License File"); chckbxLicense.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { ArgList.add(SDConstant.LICENSE); } else { ArgList.remove(SDConstant.LICENSE); } } }); chckbxLicense.setBounds(109, 164, 243, 23); contentPane.add(chckbxLicense); chckbxLicense.setOpaque(false); chckbxProcesslist = new JCheckBox("Running Process"); chckbxProcesslist.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { ArgList.add(SDConstant.RUNNING_TASK); } else { ArgList.remove(SDConstant.RUNNING_TASK); } } }); chckbxProcesslist.setBounds(109, 242, 243, 23); contentPane.add(chckbxProcesslist); chckbxProcesslist.setOpaque(false); chckbxTomcatxml = new JCheckBox("XML files from Tomcat"); chckbxTomcatxml.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { ArgList.add(SDConstant.FILE); tomcatXml = true; } else { ArgList.remove(SDConstant.FILE); tomcatXml = false; } } }); chckbxTomcatxml.setBounds(377, 242, 248, 23); contentPane.add(chckbxTomcatxml); chckbxTomcatxml.setOpaque(false); chckbxServerXml = new JCheckBox("XML files from Server"); chckbxServerXml.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { ArgList.add(SDConstant.FILE); serverXml = true; } else { ArgList.remove(SDConstant.FILE); serverXml = false; } } }); chckbxServerXml.setBounds(377, 216, 248, 23); contentPane.add(chckbxServerXml); chckbxServerXml.setOpaque(false); chckbxGetBatfiles = new JCheckBox("Start up files from server"); chckbxGetBatfiles.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { ArgList.add(SDConstant.FILE); serverBatFile = true; } else { ArgList.remove(SDConstant.FILE); serverBatFile = false; } } }); chckbxGetBatfiles.setBounds(377, 268, 248, 23); contentPane.add(chckbxGetBatfiles); chckbxGetBatfiles.setOpaque(false); chckbxServerproperties = new JCheckBox("Properites files from server"); chckbxServerproperties.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { ArgList.add(SDConstant.FILE); serverProrperties = true; } else { ArgList.remove(SDConstant.FILE); serverProrperties = false; } } }); chckbxServerproperties.setBounds(377, 294, 248, 23); contentPane.add(chckbxServerproperties); chckbxServerproperties.setOpaque(false); btnNewButton = new JButton("Package"); btnNewButton.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent arg0) { try { if (installType.equalsIgnoreCase("Manual")) { if (prop.getProperty(SDConstant.BI_TOM_PATH) == null) { JOptionPane.showMessageDialog(contentPane, SDConstant.ERROR_12, "Inane error", JOptionPane.ERROR_MESSAGE); } else { WEB_XML = new StringBuilder(); WEB_XML.append(prop.getProperty(SDConstant.BI_TOM_PATH)).append(File.separator) .append(SDConstant.WEB_APP).append(File.separator).append(SDConstant.PENTAHO) .append(File.separator).append(SDConstant.WEB_INF).append(File.separator) .append(SDConstant.WEB_XML); PENTAHO_SOLU_PATH = getSolutionPath("biserver", WEB_XML.toString()); prop.put(SDConstant.PENTAHO_SOLU_PATH, PENTAHO_SOLU_PATH); prop.put(SDConstant.BI_PATH, PENTAHO_SOLU_PATH); } } if (prop.getProperty(SDConstant.BI_PATH) == null) { JOptionPane.showMessageDialog(contentPane, SDConstant.ERROR_1, "Inane error", JOptionPane.ERROR_MESSAGE); } if (prop.getProperty(SDConstant.BI_TOM_PATH) == null) { JOptionPane.showMessageDialog(contentPane, SDConstant.ERROR_12, "Inane error", JOptionPane.ERROR_MESSAGE); } disableAll(); setBIServerPath(prop); final String data = textFieldBrowser.getText(); if (!data.equalsIgnoreCase(null)) { ArgList.add(SDConstant.BROWSER); } String[] array = new String[ArgList.size()]; int count = 0; for (int i = 0; i < ArgList.size(); i++) { String retName = ArgList.get(i); if (retName.equals("file")) { if (count == 0) { array[i] = retName; count++; } } else { array[i] = retName; } } ApplicationContext context = new ClassPathXmlApplicationContext(SDConstant.SPRNG_FILE_NAME); factory = (CofingRetrieverFactory) context.getBean("cofingRetrieverFactory"); ConfigRetreiver[] config = factory.getConfigRetrevier(array); ExecutorService service = Executors.newFixedThreadPool(10); for (final ConfigRetreiver configobj : config) { if (null != configobj) { configobj.setBISeverPath(prop); configobj.setServerName("biserver"); if (installType.equalsIgnoreCase("Installer")) { configobj.setInstallType("Installer"); } else if (installType.equalsIgnoreCase("Archive")) { configobj.setInstallType("Archive"); } else if (installType.equalsIgnoreCase("Manual")) { configobj.setInstallType("Manual"); } if (configobj instanceof FileRetriever) { configobj.setBidiXml(serverXml); configobj.setBidiBatFile(serverBatFile); configobj.setBidiProrperties(serverProrperties); configobj.setTomcatXml(tomcatXml); } if (configobj instanceof BrowserInfoRetriever) { configobj.setBrowserInfo(data); } service.execute(new Runnable() { public void run() { if (null != configobj) configobj.readAndSaveConfiguration(prop); } }); } } btnNewButton.setVisible(false); progressBar.setVisible(true); ProgressThread thread = new ProgressThread(); thread.setSupport(getSupport()); thread.setProp(prop); new Thread(thread).start(); service.shutdown(); } catch (Exception e1) { e1.printStackTrace(); } } }); chckbxSelectAll = new JCheckBox("Select/ De-select"); chckbxSelectAll.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { selectAll(); } else { deSelectAll(); } } }); chckbxSelectAll.setBounds(46, 138, 201, 23); chckbxSelectAll.setOpaque(false); contentPane.add(chckbxSelectAll); btnNewButton.setForeground(SystemColor.infoText); btnNewButton.setBounds(10, 430, 639, 37); contentPane.add(btnNewButton); chckbxServerproperties.setOpaque(false); JLabel lblAttach = new JLabel("Attach Artifact"); lblAttach.setHorizontalAlignment(SwingConstants.LEFT); lblAttach.setBounds(32, 335, 177, 23); contentPane.add(lblAttach); lblAttach.setOpaque(false); JButton btnNewButtonBrowse = new JButton("Browse"); btnNewButtonBrowse.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent arg0) { saveSelectedFile(prop); JFrame parentFrame = new JFrame(); JFileChooser fileChooser = new JFileChooser(); fileChooser.setDialogTitle("Specify a file to save"); fileChooser.setMultiSelectionEnabled(true); int userSelection = fileChooser.showSaveDialog(parentFrame); if (userSelection == JFileChooser.APPROVE_OPTION) { fileToSave = fileChooser.getSelectedFiles(); for (int i = 0; i < fileToSave.length; i++) { File file = fileToSave[i]; String artifactpath = file.getAbsolutePath(); File f = new File(artifactpath); String absolutefilename = f.getName(); String filename = ArtifactsDirectory.concat(absolutefilename); CopyFile artifactcopy = new CopyFile(artifactpath, filename); try { artifactcopy.copy(); } catch (Exception e1) { e1.printStackTrace(); } } uploadedFiles(); rowList = new JList(model); listScrollPane.setViewportView(rowList); panel.add(listScrollPane); } rowList.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { lblDelete.setVisible(true); } }); } }); btnNewButtonBrowse.setBounds(208, 335, 104, 23); contentPane.add(btnNewButtonBrowse); btnNewButtonBrowse.setOpaque(false); textFieldBrowser = new JTextField(); textFieldBrowser.setBounds(208, 364, 441, 23); contentPane.add(textFieldBrowser); textFieldBrowser.setColumns(10); progressBar = new JProgressBar(0, 100); progressBar.setBounds(8, 437, 639, 24); progressBar.setVisible(false); progressBar.setStringPainted(true); contentPane.add(progressBar); JLabel lblBrowserInformation = new JLabel("Browser Information"); lblBrowserInformation.setHorizontalAlignment(SwingConstants.LEFT); lblBrowserInformation.setLabelFor(textFieldBrowser); lblBrowserInformation.setBounds(32, 368, 174, 14); contentPane.add(lblBrowserInformation); panel = new JPanel(); panel.setBounds(423, 325, 127, 33); contentPane.add(panel); panel.setLayout(null); listScrollPane = new JScrollPane(); listScrollPane.setBounds(0, 0, 127, 33); panel.add(listScrollPane); lblDelete = new JLabel(""); lblDelete.setBounds(552, 325, 22, 23); lblDelete.setVisible(false); lblDelete.setIcon( new ImageIcon(SDSupportUtility.class.getResource("/org/pentaho/support/standalone/remove.png"))); contentPane.add(lblDelete); lblDelete.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { int option = JOptionPane.showConfirmDialog(null, "Are you sure you want to delete this file ?"); if (option == JOptionPane.YES_OPTION) { String sel = rowList.getSelectedValue().toString(); String selected = dir + "/" + sel; File fileExists = new File(selected); fileExists.delete(); model.remove(sel.indexOf(sel)); lblDelete.setVisible(false); } } }); JLabel instalType = new JLabel("Installation Type : "); instalType.setBounds(32, 395, 177, 23); instalType.setVisible(true); contentPane.add(instalType); ButtonGroup btnGrp = new ButtonGroup(); rdbtnInstaller = new JRadioButton("Installer"); rdbtnInstaller.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { installType = "Installer"; } }); rdbtnInstaller.setBounds(208, 395, 104, 23); rdbtnInstaller.setSelected(true); contentPane.add(rdbtnInstaller); btnGrp.add(rdbtnInstaller); rdbtnArchive = new JRadioButton("Archive"); rdbtnArchive.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { installType = "Archive"; } }); rdbtnArchive.setBounds(333, 395, 104, 23); contentPane.add(rdbtnArchive); btnGrp.add(rdbtnArchive); rdbtnManual = new JRadioButton("Manual"); rdbtnManual.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { installType = "Manual"; } }); rdbtnManual.setBounds(460, 395, 127, 27); contentPane.add(rdbtnManual); btnGrp.add(rdbtnManual); JLabel lblBackground = new JLabel(); lblBackground.setIcon(new ImageIcon( SDSupportUtility.class.getResource("/org/pentaho/support/standalone/login-crystal-bg.jpg"))); lblBackground.setBackground(SystemColor.controlHighlight); lblBackground.setHorizontalAlignment(SwingConstants.CENTER); lblBackground.setBounds(0, 0, 659, 488); contentPane.add(lblBackground); }
From source file:com.rapidminer.template.gui.RoleRequirementSelector.java
public RoleRequirementSelector(final TemplateController controller) { super(new BorderLayout()); setBorder(border);/* w w w . jav a 2s .c o m*/ this.controller = controller; setBackground(Color.WHITE); updateRequirement(); controller.getModel().addObserver(new Observer() { @Override public void update(Observable o, Object arg) { if (TemplateState.OBSERVER_EVENT_TEMPLATE.equals(arg)) { updateRequirement(); updateComponents(); } else if (TemplateState.OBSERVER_EVENT_ROLES.equals(arg)) { assignSelectionToCombo(); updateComponents(); attributeCombo.repaint(); } else if (TemplateState.OBSERVER_EVENT_INPUT.equals(arg)) { updateAttributes(); } } }); AutoCompleteDecorator.decorate(attributeCombo); AutoCompleteDecorator.decorate(positiveClassCombo); attributeCombo.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (areValuesAdjusting) { return; } assignRoles(); } }); positiveClassCombo.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (areValuesAdjusting) { return; } assignRoles(); } }); helpLabel.setHorizontalAlignment(SwingConstants.CENTER); add(helpLabel, BorderLayout.PAGE_START); chartPanel = new ChartPanel(null, 250, 250, 100, 100, 360, 360, true, false, false, false, false, false); chartPanel.setMinimumDrawWidth(0); chartPanel.setMaximumDrawWidth(Integer.MAX_VALUE); chartPanel.setMinimumDrawHeight(0); chartPanel.setMaximumDrawHeight(Integer.MAX_VALUE); attributeCombo.setPreferredSize(new Dimension(100, 30)); attributeCombo.setMaximumSize(new Dimension(150, 30)); add(chartPanel, BorderLayout.CENTER); JComponent comboPanel = new JPanel(); comboPanel.setLayout(new BoxLayout(comboPanel, BoxLayout.PAGE_AXIS)); JComponent comboPanelAtt = new JPanel(); comboPanelAtt.setBackground(Color.WHITE); comboPanelAtt.setLayout(new FlowLayout(FlowLayout.CENTER, 0, 0)); JComponent comboPanelClass = new JPanel(); comboPanelClass.setBackground(Color.WHITE); comboPanelClass.setLayout(new FlowLayout(FlowLayout.CENTER, 0, 0)); positiveClassCombo.setPreferredSize(new Dimension(100, 30)); positiveClassCombo.setMaximumSize(new Dimension(150, 30)); positiveClassLabel.setLabelFor(positiveClassCombo); positiveClassLabel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0)); positiveClassLabel.setToolTipText(positiveClassLabel.getText()); positiveClassLabel.setHorizontalAlignment(SwingConstants.RIGHT); columnLabel.setLabelFor(attributeCombo); columnLabel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0)); columnLabel.setToolTipText(columnLabel.getText()); columnLabel.setHorizontalAlignment(SwingConstants.RIGHT); comboPanelAtt.add(columnLabel); comboPanelAtt.add(attributeCombo); comboPanelClass.add(positiveClassLabel); comboPanelClass.add(positiveClassCombo); comboPanel.add(comboPanelAtt); comboPanel.add(comboPanelClass); add(comboPanel, BorderLayout.SOUTH); updateComponents(); }
From source file:de.mpg.mpi_inf.bioinf.netanalyzer.ui.SaveChartDialog.java
/** * Creates and lays out the controls inside this dialog's content pane. * <p>//from w ww . j av a 2 s. c o m * This method is called upon initialization only. * </p> */ private void initControls() { JPanel sizePanel = new JPanel(new GridLayout(2, 3, 4, 4)); sizePanel.setBorder(BorderFactory.createTitledBorder(Messages.DI_IMAGESIZE)); // Add a spinner for choosing width sizePanel.add(new JLabel(Messages.DI_WIDTH, SwingConstants.RIGHT)); int width = ChartPanel.DEFAULT_WIDTH; int minWidth = ChartPanel.DEFAULT_MINIMUM_DRAW_WIDTH; int maxWidth = ChartPanel.DEFAULT_MAXIMUM_DRAW_WIDTH; SpinnerModel widthSettings = new SpinnerNumberModel(width, minWidth, maxWidth, 1); sizePanel.add(widthSpinner = new JSpinner(widthSettings)); sizePanel.add(new JLabel(Messages.DI_PIXELS)); // Add a spinner for choosing height sizePanel.add(new JLabel(Messages.DI_HEIGHT, SwingConstants.RIGHT)); int height = ChartPanel.DEFAULT_HEIGHT; int minHeight = ChartPanel.DEFAULT_MINIMUM_DRAW_HEIGHT; int maxHeight = ChartPanel.DEFAULT_MAXIMUM_DRAW_HEIGHT; SpinnerModel heightSettings = new SpinnerNumberModel(height, minHeight, maxHeight, 1); sizePanel.add(heightSpinner = new JSpinner(heightSettings)); sizePanel.add(new JLabel(Messages.DI_PIXELS)); // Add Save and Cancel buttons JPanel buttons = new JPanel(new GridLayout(1, 2, 4, 0)); buttons.add(btnSave = Utils.createButton(Messages.DI_SAVE, null, this)); buttons.add(btnCancel = Utils.createButton(Messages.DI_CANCEL, null, this)); Box buttonsBox = Box.createHorizontalBox(); buttonsBox.add(Box.createHorizontalGlue()); buttonsBox.add(buttons); buttonsBox.add(Box.createHorizontalGlue()); Container contentPane = getContentPane(); contentPane.add(sizePanel, BorderLayout.NORTH); contentPane.add(Box.createVerticalStrut(Utils.BORDER_SIZE / 2)); contentPane.add(buttonsBox, BorderLayout.PAGE_END); setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); Utils.setStandardBorder(getRootPane()); }
From source file:com.simplexrepaginator.RepaginateFrame.java
protected JButton createUnrepaginateButton() { JButton b = new JButton("<html><center>Click to<br>un-repaginate", UNREPAGINATE_ICON); b.setHorizontalTextPosition(SwingConstants.RIGHT); b.setIconTextGap(25);//from w w w . j a va2s . co m b.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { try { int[] documentsPages = repaginator.unrepaginate(); JOptionPane.showMessageDialog( RepaginateFrame.this, "Unrepaginated " + documentsPages[0] + " documents with " + documentsPages[1] + " pages.", "Unrepagination Complete", JOptionPane.INFORMATION_MESSAGE); } catch (Exception ex) { ex.printStackTrace(); JOptionPane.showMessageDialog(RepaginateFrame.this, ex.toString(), "Error During Unrepagination", JOptionPane.ERROR_MESSAGE); } } }); return b; }
From source file:gda.gui.beans.BeanBase.java
protected JTextField getTxtValue() { if (txtValue == null) { txtValue = new JFormattedTextField(); // When the text box loses focus, keep the edited value. This will be reverted eventually by the // main update loop //TODO this will cause the text to revert from 1700 to 1,700 . We need to set the formatter to simple or do not use this box at all. //Currently we handle the comma in the txtValueActionPerformed txtValue.setFocusLostBehavior(JFormattedTextField.PERSIST); txtValue.setValue(new Double(100)); txtValue.setText("position"); txtValue.setHorizontalAlignment(SwingConstants.RIGHT); txtValue.setPreferredSize(new java.awt.Dimension(60, 19)); txtValue.setMinimumSize(new java.awt.Dimension(60, 19)); txtValue.addActionListener(new ActionListener() { @Override// ww w . j a va2s . c o m public void actionPerformed(ActionEvent evt) { // Remove focus from the text field, so it updates as the motor moves requestFocus(); // do this in a new thread that's not the event thread. uk.ac.gda.util.ThreadManager.getThread(new Runnable() { @Override public void run() { manualUpdate = true; txtValueActionPerformed(); } }).start(); } }); } return txtValue; }
From source file:edu.ku.brc.specify.conversion.CustomDBConverterPanel.java
/** * Creates a line in the form.//from w w w .ja va 2 s. c o m * * @param label JLabel text * @param comp the component to be added * @param pb the PanelBuilder to use * @param cc the CellConstratins to use * @param y the 'y' coordinate in the layout of the form * @return return an incremented by 2 'y' position */ protected int addLine(final String label, final JComponent comp, final PanelBuilder pb, final CellConstraints cc, final int y) { int yy = y; pb.add(createLabel(label != null ? getResourceString(label) + ":" : " ", SwingConstants.RIGHT), cc.xy(1, yy)); pb.add(comp, cc.xy(3, yy)); yy += 2; return yy; }
From source file:edu.virginia.speclab.juxta.author.view.export.WebServiceExportDialog.java
/** * Creates the UI panel containing all of the fields necessary to upload * the current session data to the web service *///w w w. ja v a 2s. c o m private void createSetupPane() { this.setupPanel = new JPanel(); this.setupPanel.setLayout(new BorderLayout()); this.setupPanel.setBackground(Color.white); try { String data = IOUtils.toString(LoginDialog.class.getResourceAsStream("/export2.html")); data = data.replace("{LIST}", formatWitnessList()); JLabel txt = new JLabel(data); this.setupPanel.add(txt, BorderLayout.NORTH); } catch (IOException e) { // dunno. not much that can be done! } // ugly layout code to follow. avert your eyes JPanel data = new JPanel(); data.setLayout(new BorderLayout()); data.setBackground(Color.white); JPanel names = new JPanel(); names.setLayout(new BoxLayout(names, BoxLayout.Y_AXIS)); names.setBackground(Color.white); JLabel l = new JLabel("Name:", SwingConstants.RIGHT); l.setPreferredSize(new Dimension(100, 20)); l.setMaximumSize(new Dimension(100, 20)); l.setAlignmentX(RIGHT_ALIGNMENT); names.add(l); names.add(Box.createVerticalStrut(5)); JLabel l2 = new JLabel("Description:", SwingConstants.RIGHT); l2.setPreferredSize(new Dimension(100, 20)); l2.setMaximumSize(new Dimension(100, 20)); l2.setAlignmentX(RIGHT_ALIGNMENT); names.add(l2); data.add(names, BorderLayout.WEST); JPanel edits = new JPanel(); edits.setBackground(Color.white); edits.setLayout(new BoxLayout(edits, BoxLayout.Y_AXIS)); this.nameEdit = new JTextField(); this.nameEdit.setPreferredSize(new Dimension(200, 22)); this.nameEdit.setMaximumSize(new Dimension(200, 22)); File saveFile = this.juxtaFrame.getSession().getSaveFile(); if (saveFile == null) { this.nameEdit.setText("new_session"); } else { String name = saveFile.getName(); this.nameEdit.setText(name.substring(0, name.lastIndexOf('.'))); } edits.add(this.nameEdit); this.descriptionEdit = new JTextArea(3, 0); this.descriptionEdit.setLineWrap(true); this.descriptionEdit.setWrapStyleWord(true); JScrollPane sp = new JScrollPane(this.descriptionEdit); sp.setPreferredSize(new Dimension(194, 60)); sp.setMaximumSize(new Dimension(194, 300)); edits.add(Box.createVerticalStrut(4)); edits.add(sp); data.add(edits, BorderLayout.CENTER); this.setupPanel.add(data, BorderLayout.SOUTH); }