List of usage examples for java.awt GridBagConstraints BOTH
int BOTH
To view the source code for java.awt GridBagConstraints BOTH.
Click Source Link
From source file:at.becast.youploader.gui.FrmMain.java
public void initQueuetab() { JScrollPane TabQueues = new JScrollPane(); QueuePanel = new JPanel(); TabQueues.setViewportView(QueuePanel); QueuePanel.setLayout(new MigLayout("", "[875px,grow,fill]", "[][][][]")); JPanel buttonPanel = new JPanel(); GridBagConstraints gbc_panel_2 = new GridBagConstraints(); gbc_panel_2.fill = GridBagConstraints.BOTH; gbc_panel_2.gridx = 0;/*from w w w . j a va 2 s.c o m*/ gbc_panel_2.gridy = 1; buttonPanel.setLayout(new FormLayout(new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"), FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"), FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("max(39dlu;default)"), FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("max(92dlu;default)"), FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("max(46dlu;min)"), FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("left:max(22dlu;default)"), FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, }, new RowSpec[] { FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, RowSpec.decode("max(0dlu;default)"), })); JButton btnStart = new JButton(LANG.getString("frmMain.start")); btnStart.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { startUploads(); } }); JLabel lblAfterUploadsFinish = new JLabel(LANG.getString("frmMain.afterfinish")); buttonPanel.add(lblAfterUploadsFinish, "10, 2, 7, 1"); buttonPanel.add(btnStart, "2, 4"); JButton btnStop = new JButton(LANG.getString("frmMain.stop")); btnStop.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { UploadMgr.stop(); } }); buttonPanel.add(btnStop, "6, 4"); cmbAfterFinish = new JComboBox<Object>(); cmbAfterFinish.setModel(new DefaultComboBoxModel<Object>(new String[] { LANG.getString("frmMain.afterfinish.donothing"), LANG.getString("frmMain.afterfinish.suspend"), LANG.getString("frmMain.afterfinish.shutdown") })); buttonPanel.add(cmbAfterFinish, "10, 4, 7, 1, fill, default"); JLabel lblUploads = new JLabel(LANG.getString("frmMain.uploads") + ":"); buttonPanel.add(lblUploads, "18, 4, right, fill"); JSlider slider = new JSlider(); slider.setPaintTicks(true); slider.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { JSlider s = (JSlider) evt.getSource(); UploadMgr.setUploadlimit(s.getValue()); } }); slider.setMajorTickSpacing(1); slider.setMinorTickSpacing(1); slider.setMinimum(1); slider.setMaximum(5); slider.setValue(1); slider.setSnapToTicks(true); slider.setPaintLabels(true); buttonPanel.add(slider, "20, 4, fill, fill"); JLabel lblUploadSpeed = new JLabel(LANG.getString("frmMain.uploadspeed") + ":"); lblUploadSpeed.setHorizontalAlignment(SwingConstants.TRAILING); buttonPanel.add(lblUploadSpeed, "24, 4"); spinner = new JSpinner(); spinner.setModel(new SpinnerNumberModel(new Integer(0), new Integer(0), null, new Integer(10))); spinner.setEditor(new SpeedValuesSpinnerEditor(spinner)); spinner.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { JSpinner s = (JSpinner) e.getSource(); speed = Integer.parseInt(s.getValue().toString()); Main.s.put("speed", String.valueOf(speed)); UploadMgr.setLimit(speed); } }); spinner.setValue(speed); buttonPanel.add(spinner, "26, 4"); JLabel lblKbps = new JLabel("kbps"); buttonPanel.add(lblKbps, "28, 4"); JPanel TabQueue = new JPanel(); TabbedPane.addTab(LANG.getString("frmMain.Tabs.Queue"), null, TabQueue, null); TabQueue.setLayout(new BorderLayout(0, 0)); TabQueue.add(buttonPanel, BorderLayout.SOUTH); TabQueue.add(TabQueues, BorderLayout.CENTER); }
From source file:com.polivoto.vistas.AnalistaLocal.java
/** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor.// w w w. j a v a 2s . c om */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; Panel3 = new javax.swing.JPanel(); jLabel5 = new javax.swing.JLabel(); jLabel1 = new javax.swing.JLabel(); Panel1 = new javax.swing.JPanel(); lblmsj_esperando = new javax.swing.JLabel(); lbl_cargando = new javax.swing.JLabel(); Panel2 = new javax.swing.JPanel(); lblmsj_esperando1 = new javax.swing.JLabel(); lbl_cargando1 = new javax.swing.JLabel(); jPanel1 = new javax.swing.JPanel(); panelPrincipal = new javax.swing.JPanel(); panelVotosTotales = new javax.swing.JPanel(); lbl_votos_totales = new javax.swing.JLabel(); jPanel7 = new javax.swing.JPanel(); lblvotos_totales = new javax.swing.JLabel(); panelVotando = new javax.swing.JPanel(); panelMain = new javax.swing.JPanel(); panelEstado = new javax.swing.JPanel(); encabezado = new javax.swing.JLabel(); panelPreguntas = new javax.swing.JPanel(); panelPorcentaje = new javax.swing.JPanel(); lbl_porcentaje = new javax.swing.JLabel(); jPanel8 = new javax.swing.JPanel(); lblporcentaje = new javax.swing.JLabel(); pnlgrafica = new javax.swing.JPanel(); panelTimer = new javax.swing.JPanel(); lbl_tiemporest = new javax.swing.JLabel(); jPanel9 = new javax.swing.JPanel(); lblhrs = new javax.swing.JLabel(); lblmin = new javax.swing.JLabel(); lblseg = new javax.swing.JLabel(); lblpuntos = new javax.swing.JLabel(); lblpuntos1 = new javax.swing.JLabel(); Panel3.setBackground(new java.awt.Color(255, 255, 255)); jLabel5.setFont(new java.awt.Font("Roboto", 0, 18)); // NOI18N jLabel5.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); jLabel5.setText("AHORA PUEDES CONSULTAR LOS RESULTADOS FINALES."); jLabel1.setIcon( new javax.swing.ImageIcon(getClass().getResource("/com/polivoto/imagenes/boton-consultar1.png"))); // NOI18N jLabel1.addMouseListener(new java.awt.event.MouseAdapter() { public void mousePressed(java.awt.event.MouseEvent evt) { jLabel1MousePressed(evt); } public void mouseReleased(java.awt.event.MouseEvent evt) { jLabel1MouseReleased(evt); } public void mouseClicked(java.awt.event.MouseEvent evt) { jLabel1MouseClicked(evt); } public void mouseExited(java.awt.event.MouseEvent evt) { jLabel1MouseExited(evt); } public void mouseEntered(java.awt.event.MouseEvent evt) { jLabel1MouseEntered(evt); } }); javax.swing.GroupLayout Panel3Layout = new javax.swing.GroupLayout(Panel3); Panel3.setLayout(Panel3Layout); Panel3Layout.setHorizontalGroup(Panel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel5, javax.swing.GroupLayout.DEFAULT_SIZE, 696, Short.MAX_VALUE) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, Panel3Layout.createSequentialGroup() .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel1) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); Panel3Layout.setVerticalGroup(Panel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(Panel3Layout.createSequentialGroup().addGap(110, 110, 110).addComponent(jLabel5) .addGap(43, 43, 43).addComponent(jLabel1).addContainerGap(40, Short.MAX_VALUE))); Panel1.setBackground(new java.awt.Color(255, 255, 255)); lblmsj_esperando.setFont(new java.awt.Font("Roboto", 0, 18)); // NOI18N lblmsj_esperando.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); lblmsj_esperando.setText("<html><div align=\"center\">CMO VOTAR</html>"); lbl_cargando.setIcon( new javax.swing.ImageIcon(getClass().getResource("/com/polivoto/imagenes/participando.gif"))); // NOI18N javax.swing.GroupLayout Panel1Layout = new javax.swing.GroupLayout(Panel1); Panel1.setLayout(Panel1Layout); Panel1Layout.setHorizontalGroup(Panel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(lblmsj_esperando).addGroup(javax.swing.GroupLayout.Alignment.TRAILING, Panel1Layout.createSequentialGroup() .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(lbl_cargando) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); Panel1Layout.setVerticalGroup(Panel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(Panel1Layout.createSequentialGroup().addGap(20, 20, 20) .addComponent(lblmsj_esperando, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18).addComponent(lbl_cargando).addGap(30, 30, 30))); Panel2.setBackground(new java.awt.Color(255, 255, 255)); lblmsj_esperando1.setFont(new java.awt.Font("Roboto", 0, 18)); // NOI18N lblmsj_esperando1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); lblmsj_esperando1.setText( "<html><div align=\"center\">ESPERANDO A LOS LTIMOS USUARIOS QUE YA HAB?AN INICIADO SU PROCESO DE VOTACIN FINALICEN.</html>"); lbl_cargando1 .setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/polivoto/imagenes/espera.gif"))); // NOI18N javax.swing.GroupLayout Panel2Layout = new javax.swing.GroupLayout(Panel2); Panel2.setLayout(Panel2Layout); Panel2Layout.setHorizontalGroup(Panel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(lblmsj_esperando1, javax.swing.GroupLayout.DEFAULT_SIZE, 620, Short.MAX_VALUE) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, Panel2Layout.createSequentialGroup() .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(lbl_cargando1) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); Panel2Layout.setVerticalGroup(Panel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(Panel2Layout.createSequentialGroup().addGap(20, 20, 20) .addComponent(lblmsj_esperando1, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18).addComponent(lbl_cargando1).addContainerGap(34, Short.MAX_VALUE))); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setTitle("VOTACIONES EN CURSO"); jPanel1.setBackground(new java.awt.Color(134, 36, 31)); jPanel1.setPreferredSize(new java.awt.Dimension(846, 60)); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup(jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 0, Short.MAX_VALUE)); jPanel1Layout.setVerticalGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 60, Short.MAX_VALUE)); panelPrincipal.setLayout(new java.awt.GridBagLayout()); panelVotosTotales.setBackground(new java.awt.Color(255, 255, 255)); panelVotosTotales.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(102, 0, 0), 3, true)); lbl_votos_totales.setFont(new java.awt.Font("Roboto", 1, 16)); // NOI18N lbl_votos_totales.setText("VOTOS TOTALES:"); jPanel7.setBackground(new java.awt.Color(255, 255, 255)); lblvotos_totales.setFont(new java.awt.Font("Roboto", 1, 100)); // NOI18N lblvotos_totales.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); lblvotos_totales.setText("0"); javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7); jPanel7.setLayout(jPanel7Layout); jPanel7Layout .setHorizontalGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel7Layout.createSequentialGroup().addGap(10, 10, 10) .addComponent(lblvotos_totales, javax.swing.GroupLayout.PREFERRED_SIZE, 300, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(567, Short.MAX_VALUE))); jPanel7Layout.setVerticalGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel7Layout.createSequentialGroup().addGap(20, 20, 20) .addComponent(lblvotos_totales, javax.swing.GroupLayout.PREFERRED_SIZE, 96, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); javax.swing.GroupLayout panelVotosTotalesLayout = new javax.swing.GroupLayout(panelVotosTotales); panelVotosTotales.setLayout(panelVotosTotalesLayout); panelVotosTotalesLayout.setHorizontalGroup( panelVotosTotalesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(panelVotosTotalesLayout.createSequentialGroup().addGap(7, 7, 7) .addGroup(panelVotosTotalesLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel7, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(panelVotosTotalesLayout.createSequentialGroup() .addComponent(lbl_votos_totales).addGap(0, 750, Short.MAX_VALUE))) .addContainerGap())); panelVotosTotalesLayout .setVerticalGroup( panelVotosTotalesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(panelVotosTotalesLayout.createSequentialGroup().addGap(7, 7, 7) .addComponent(lbl_votos_totales).addGap(8, 8, 8) .addComponent(jPanel7, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addContainerGap())); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.weightx = 0.1; gridBagConstraints.weighty = 1.0; gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5); panelPrincipal.add(panelVotosTotales, gridBagConstraints); panelVotando.setBackground(new java.awt.Color(255, 255, 255)); panelVotando.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(102, 0, 0), 3, true)); panelMain.setBackground(new java.awt.Color(255, 255, 255)); javax.swing.GroupLayout panelMainLayout = new javax.swing.GroupLayout(panelMain); panelMain.setLayout(panelMainLayout); panelMainLayout.setHorizontalGroup(panelMainLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 0, Short.MAX_VALUE)); panelMainLayout.setVerticalGroup(panelMainLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 359, Short.MAX_VALUE)); panelEstado.setBackground(new java.awt.Color(255, 255, 255)); encabezado.setBackground(new java.awt.Color(255, 255, 255)); encabezado.setFont(new java.awt.Font("Roboto", 1, 30)); // NOI18N encabezado.setForeground(new java.awt.Color(134, 36, 31)); encabezado.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); encabezado.setText("VOTACIONES EN PROGRESO "); javax.swing.GroupLayout panelEstadoLayout = new javax.swing.GroupLayout(panelEstado); panelEstado.setLayout(panelEstadoLayout); panelEstadoLayout .setHorizontalGroup(panelEstadoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(encabezado, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)); panelEstadoLayout.setVerticalGroup(panelEstadoLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(encabezado, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE)); panelPreguntas.setBackground(new java.awt.Color(255, 255, 255)); javax.swing.GroupLayout panelPreguntasLayout = new javax.swing.GroupLayout(panelPreguntas); panelPreguntas.setLayout(panelPreguntasLayout); panelPreguntasLayout.setHorizontalGroup(panelPreguntasLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 0, Short.MAX_VALUE)); panelPreguntasLayout.setVerticalGroup(panelPreguntasLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 390, Short.MAX_VALUE)); javax.swing.GroupLayout panelVotandoLayout = new javax.swing.GroupLayout(panelVotando); panelVotando.setLayout(panelVotandoLayout); panelVotandoLayout.setHorizontalGroup( panelVotandoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(panelVotandoLayout.createSequentialGroup().addGap(7, 7, 7) .addComponent(panelEstado, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGap(10, 10, 10)) .addGroup(panelVotandoLayout.createSequentialGroup() .addComponent(panelMain, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addContainerGap()) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelVotandoLayout.createSequentialGroup().addContainerGap().addComponent( panelPreguntas, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); panelVotandoLayout.setVerticalGroup(panelVotandoLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(panelVotandoLayout.createSequentialGroup().addGap(7, 7, 7) .addComponent(panelEstado, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(30, 30, 30) .addComponent(panelPreguntas, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(panelMain, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap())); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 0; gridBagConstraints.gridheight = 3; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5); panelPrincipal.add(panelVotando, gridBagConstraints); panelPorcentaje.setBackground(new java.awt.Color(255, 255, 255)); panelPorcentaje.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(102, 0, 0), 3, true)); panelPorcentaje.setMaximumSize(new java.awt.Dimension(589, 205)); lbl_porcentaje.setFont(new java.awt.Font("Roboto", 1, 20)); // NOI18N lbl_porcentaje.setText("PORCENTAJE DE PARTICIPACIN:"); jPanel8.setBackground(new java.awt.Color(255, 255, 255)); jPanel8.setMaximumSize(new java.awt.Dimension(564, 155)); lblporcentaje.setBackground(new java.awt.Color(255, 255, 255)); lblporcentaje.setFont(new java.awt.Font("Roboto", 1, 80)); // NOI18N lblporcentaje.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); lblporcentaje.setText("0%"); pnlgrafica.setEnabled(false); pnlgrafica.setMaximumSize(new java.awt.Dimension(161, 131)); javax.swing.GroupLayout pnlgraficaLayout = new javax.swing.GroupLayout(pnlgrafica); pnlgrafica.setLayout(pnlgraficaLayout); pnlgraficaLayout.setHorizontalGroup(pnlgraficaLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 161, Short.MAX_VALUE)); pnlgraficaLayout.setVerticalGroup(pnlgraficaLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 131, Short.MAX_VALUE)); javax.swing.GroupLayout jPanel8Layout = new javax.swing.GroupLayout(jPanel8); jPanel8.setLayout(jPanel8Layout); jPanel8Layout .setHorizontalGroup( jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel8Layout.createSequentialGroup().addContainerGap() .addComponent(lblporcentaje, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGap(34, 34, 34) .addComponent(pnlgrafica, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(22, 22, 22))); jPanel8Layout.setVerticalGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel8Layout.createSequentialGroup().addContainerGap().addGroup(jPanel8Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(pnlgrafica, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(lblporcentaje, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); javax.swing.GroupLayout panelPorcentajeLayout = new javax.swing.GroupLayout(panelPorcentaje); panelPorcentaje.setLayout(panelPorcentajeLayout); panelPorcentajeLayout.setHorizontalGroup( panelPorcentajeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(panelPorcentajeLayout.createSequentialGroup().addGap(7, 7, 7) .addGroup(panelPorcentajeLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel8, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(panelPorcentajeLayout.createSequentialGroup() .addComponent(lbl_porcentaje).addGap(0, 0, Short.MAX_VALUE))) .addContainerGap())); panelPorcentajeLayout.setVerticalGroup(panelPorcentajeLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(panelPorcentajeLayout.createSequentialGroup().addGap(7, 7, 7).addComponent(lbl_porcentaje) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGroup(panelPorcentajeLayout.createSequentialGroup().addGap(32, 32, 32).addComponent(jPanel8, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addContainerGap())); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.weightx = 0.1; gridBagConstraints.weighty = 1.0; gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5); panelPrincipal.add(panelPorcentaje, gridBagConstraints); panelTimer.setBackground(new java.awt.Color(255, 255, 255)); panelTimer.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(102, 0, 0), 3, true)); panelTimer.setMaximumSize(new java.awt.Dimension(535, 185)); panelTimer.setMinimumSize(new java.awt.Dimension(535, 185)); lbl_tiemporest.setFont(new java.awt.Font("Roboto", 1, 18)); // NOI18N lbl_tiemporest.setText("TIEMPO RESTANTE:"); jPanel9.setBackground(new java.awt.Color(255, 255, 255)); jPanel9.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); lblhrs.setBackground(new java.awt.Color(255, 255, 255)); lblhrs.setFont(new java.awt.Font("Roboto", 1, 90)); // NOI18N lblhrs.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); lblhrs.setText("00"); lblhrs.setOpaque(true); jPanel9.add(lblhrs, new org.netbeans.lib.awtextra.AbsoluteConstraints(30, 60, 160, 80)); lblmin.setBackground(new java.awt.Color(255, 255, 255)); lblmin.setFont(new java.awt.Font("Roboto", 1, 90)); // NOI18N lblmin.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); lblmin.setText("00"); lblmin.setOpaque(true); jPanel9.add(lblmin, new org.netbeans.lib.awtextra.AbsoluteConstraints(220, 60, 140, 80)); lblseg.setBackground(new java.awt.Color(255, 255, 255)); lblseg.setFont(new java.awt.Font("Roboto", 1, 90)); // NOI18N lblseg.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); lblseg.setText("00"); lblseg.setOpaque(true); jPanel9.add(lblseg, new org.netbeans.lib.awtextra.AbsoluteConstraints(380, 60, 150, 80)); lblpuntos.setBackground(new java.awt.Color(255, 255, 255)); lblpuntos.setFont(new java.awt.Font("Roboto", 1, 90)); // NOI18N lblpuntos.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); lblpuntos.setText(":"); lblpuntos.setOpaque(true); jPanel9.add(lblpuntos, new org.netbeans.lib.awtextra.AbsoluteConstraints(350, 60, 40, 70)); lblpuntos1.setBackground(new java.awt.Color(255, 255, 255)); lblpuntos1.setFont(new java.awt.Font("Roboto", 1, 90)); // NOI18N lblpuntos1.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); lblpuntos1.setText(":"); lblpuntos1.setOpaque(true); jPanel9.add(lblpuntos1, new org.netbeans.lib.awtextra.AbsoluteConstraints(190, 60, 40, 70)); javax.swing.GroupLayout panelTimerLayout = new javax.swing.GroupLayout(panelTimer); panelTimer.setLayout(panelTimerLayout); panelTimerLayout.setHorizontalGroup(panelTimerLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(panelTimerLayout.createSequentialGroup().addGap(7, 7, 7) .addGroup(panelTimerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel9, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(panelTimerLayout.createSequentialGroup().addComponent(lbl_tiemporest) .addGap(0, 0, Short.MAX_VALUE))) .addContainerGap())); panelTimerLayout.setVerticalGroup(panelTimerLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(panelTimerLayout.createSequentialGroup().addGap(7, 7, 7).addComponent(lbl_tiemporest) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGroup(panelTimerLayout.createSequentialGroup().addGap(27, 27, 27).addComponent(jPanel9, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addContainerGap())); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.weightx = 0.1; gridBagConstraints.weighty = 1.0; gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5); panelPrincipal.add(panelTimer, gridBagConstraints); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 1397, Short.MAX_VALUE) .addComponent(panelPrincipal, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)); layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(panelPrincipal, javax.swing.GroupLayout.DEFAULT_SIZE, 902, Short.MAX_VALUE))); pack(); }
From source file:net.technicpack.launcher.ui.InstallerFrame.java
private void setupPortableMode(JPanel panel) { panel.setLayout(new GridBagLayout()); JLabel portableSpiel = new JLabel("<html><body align=\"left\" style='margin-right:10px;'>" + resources.getString("launcher.installer.portablespiel") + "</body></html>"); portableSpiel.setFont(resources.getFont(ResourceLoader.FONT_OPENSANS, 16)); portableSpiel.setForeground(LauncherFrame.COLOR_WHITE_TEXT); portableSpiel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); panel.add(portableSpiel, new GridBagConstraints(0, 0, 3, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(9, 8, 9, 3), 0, 0)); panel.add(Box.createGlue(), new GridBagConstraints(0, 1, 3, 1, 1.0, 0.7, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); JLabel installFolderLabel = new JLabel(resources.getString("launcher.installer.folder")); installFolderLabel.setFont(resources.getFont(ResourceLoader.FONT_OPENSANS, 18)); installFolderLabel.setForeground(LauncherFrame.COLOR_WHITE_TEXT); panel.add(installFolderLabel, new GridBagConstraints(0, 2, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 24, 0, 8), 0, 0)); String installDir = ""; if (settings.isPortable()) installDir = settings.getTechnicRoot().getAbsolutePath(); portableInstallDir = new JTextField(installDir); portableInstallDir.setFont(resources.getFont(ResourceLoader.FONT_OPENSANS, 18)); portableInstallDir.setForeground(LauncherFrame.COLOR_BLUE); portableInstallDir.setBackground(LauncherFrame.COLOR_FORMELEMENT_INTERNAL); portableInstallDir.setHighlighter(null); portableInstallDir.setEditable(false); portableInstallDir.setCursor(null);/*w ww . ja v a2 s. c o m*/ portableInstallDir.setBorder(new RoundBorder(LauncherFrame.COLOR_BUTTON_BLUE, 1, 8)); panel.add(portableInstallDir, new GridBagConstraints(1, 2, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 5, 0, 5), 0, 0)); RoundedButton selectInstall = new RoundedButton(resources.getString("launcher.installer.select")); selectInstall.setFont(resources.getFont(ResourceLoader.FONT_OPENSANS, 18)); selectInstall.setContentAreaFilled(false); selectInstall.setForeground(LauncherFrame.COLOR_BUTTON_BLUE); selectInstall.setHoverForeground(LauncherFrame.COLOR_BLUE); selectInstall.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { selectPortable(); } }); panel.add(selectInstall, new GridBagConstraints(2, 2, 1, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 5, 0, 16), 0, 0)); panel.add(Box.createGlue(), new GridBagConstraints(0, 3, 3, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); String defaultLocaleText = resources.getString("launcheroptions.language.default"); if (!resources.isDefaultLocaleSupported()) { defaultLocaleText = defaultLocaleText .concat(" (" + resources.getString("launcheroptions.language.unavailable") + ")"); } portableLanguages = new JComboBox(); portableLanguages.addItem(new LanguageItem(ResourceLoader.DEFAULT_LOCALE, defaultLocaleText, resources)); for (int i = 0; i < ResourceLoader.SUPPORTED_LOCALES.length; i++) { portableLanguages .addItem(new LanguageItem(resources.getCodeFromLocale(ResourceLoader.SUPPORTED_LOCALES[i]), ResourceLoader.SUPPORTED_LOCALES[i].getDisplayName(ResourceLoader.SUPPORTED_LOCALES[i]), resources.getVariant(ResourceLoader.SUPPORTED_LOCALES[i]))); } if (!settings.getLanguageCode().equalsIgnoreCase(ResourceLoader.DEFAULT_LOCALE)) { Locale loc = resources.getLocaleFromCode(settings.getLanguageCode()); for (int i = 0; i < ResourceLoader.SUPPORTED_LOCALES.length; i++) { if (loc.equals(ResourceLoader.SUPPORTED_LOCALES[i])) { portableLanguages.setSelectedIndex(i + 1); break; } } } portableLanguages.setBorder(new RoundBorder(LauncherFrame.COLOR_SCROLL_THUMB, 1, 10)); portableLanguages.setFont(resources.getFont(ResourceLoader.FONT_OPENSANS, 14)); portableLanguages.setUI(new LanguageCellUI(resources)); portableLanguages.setForeground(LauncherFrame.COLOR_WHITE_TEXT); portableLanguages.setBackground(LauncherFrame.COLOR_SELECTOR_BACK); portableLanguages.setRenderer(new LanguageCellRenderer(resources, "globe.png", LauncherFrame.COLOR_SELECTOR_BACK, LauncherFrame.COLOR_WHITE_TEXT)); portableLanguages.setEditable(false); portableLanguages.setFocusable(false); portableLanguages.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { portableLanguageChanged(); } }); panel.add(portableLanguages, new GridBagConstraints(0, 4, 1, 0, 0, 0, GridBagConstraints.SOUTHWEST, GridBagConstraints.NONE, new Insets(0, 8, 8, 0), 0, 0)); portableInstallButton = new RoundedButton(resources.getString("launcher.installer.install")); portableInstallButton.setFont(resources.getFont(ResourceLoader.FONT_OPENSANS, 18)); portableInstallButton.setContentAreaFilled(false); portableInstallButton.setForeground(LauncherFrame.COLOR_GREY_TEXT); portableInstallButton.setHoverForeground(LauncherFrame.COLOR_BLUE); portableInstallButton.setBorder(BorderFactory.createEmptyBorder(8, 56, 8, 56)); portableInstallButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { portableInstall(); } }); portableInstallButton.setEnabled(false); if (!installDir.equals("")) { portableInstallButton.setForeground(LauncherFrame.COLOR_BUTTON_BLUE); portableInstallButton.setEnabled(true); } panel.add(portableInstallButton, new GridBagConstraints(1, 4, 2, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.VERTICAL, new Insets(0, 0, 8, 8), 0, 0)); }
From source file:org.nebulaframework.ui.swing.cluster.ClusterMainUI.java
/** * Creates a tab pane for the given GridJob. * //from www . j a va2s. c om * @param jobId JobId */ protected void createJobTab(final String jobId) { // Request Job Profile final InternalClusterJobService jobService = ClusterManager.getInstance().getJobService(); final GridJobProfile profile = jobService.getProfile(jobId); // Job Start Time final long startTime = System.currentTimeMillis(); final JPanel jobPanel = new JPanel(); jobPanel.setLayout(new BorderLayout(10, 10)); // Progess Panel JPanel progressPanel = new JPanel(); progressPanel.setLayout(new BorderLayout(10, 10)); progressPanel.setBorder(BorderFactory.createTitledBorder("Progress")); jobPanel.add(progressPanel, BorderLayout.NORTH); final JProgressBar progressBar = new JProgressBar(); progressBar.setStringPainted(true); progressPanel.add(progressBar, BorderLayout.CENTER); addUIElement("jobs." + jobId + ".progress", progressBar); // Add to components map // Buttons Panel JPanel buttonsPanel = new JPanel(); jobPanel.add(buttonsPanel, BorderLayout.SOUTH); buttonsPanel.setLayout(new FlowLayout(FlowLayout.RIGHT)); // Terminate Button JButton terminateButton = new JButton("Terminate"); terminateButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { new Thread(new Runnable() { public void run() { // Job Name = Class Name String name = profile.getJob().getClass().getSimpleName(); // Request user confirmation int option = JOptionPane.showConfirmDialog(ClusterMainUI.this, "Are you sure to terminate GridJob " + name + "?", "Nebula - Terminate GridJob", JOptionPane.YES_NO_OPTION); if (option == JOptionPane.NO_OPTION) return; // Attempt Cancel boolean result = profile.getFuture().cancel(); // Notify results if (result) { JOptionPane.showMessageDialog(ClusterMainUI.this, "Grid Job '" + name + "terminated successfully.", "Nebula - Job Terminated", JOptionPane.INFORMATION_MESSAGE); } else { JOptionPane.showMessageDialog(ClusterMainUI.this, "Failed to terminate Grid Job '" + name, "Nebula - Job Termination Failed", JOptionPane.WARNING_MESSAGE); } } }).start(); } }); buttonsPanel.add(terminateButton); addUIElement("jobs." + jobId + ".terminate", terminateButton); // Add to components map // Close Tab Button JButton closeButton = new JButton("Close Tab"); closeButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { SwingUtilities.invokeLater(new Runnable() { public void run() { removeJobTab(jobId); } }); } }); closeButton.setEnabled(false); buttonsPanel.add(closeButton); addUIElement("jobs." + jobId + ".closetab", closeButton); // Add to components map JPanel centerPanel = new JPanel(); centerPanel.setLayout(new GridBagLayout()); jobPanel.add(centerPanel, BorderLayout.CENTER); GridBagConstraints c = new GridBagConstraints(); c.fill = GridBagConstraints.BOTH; c.weightx = 1.0; c.weightx = 1.0; /* -- Job Information -- */ JPanel jobInfoPanel = new JPanel(); jobInfoPanel.setBorder(BorderFactory.createTitledBorder("Job Information")); jobInfoPanel.setLayout(new GridBagLayout()); c.gridy = 0; c.ipady = 30; centerPanel.add(jobInfoPanel, c); GridBagConstraints c1 = new GridBagConstraints(); c1.fill = GridBagConstraints.BOTH; c1.weightx = 1; c1.weighty = 1; // Name jobInfoPanel.add(new JLabel("Name :"), c1); JLabel jobNameLabel = new JLabel(); jobInfoPanel.add(jobNameLabel, c1); jobNameLabel.setText(profile.getJob().getClass().getSimpleName()); addUIElement("jobs." + jobId + ".job.name", jobNameLabel); // Add to components map // Gap jobInfoPanel.add(new JLabel(), c1); // Type jobInfoPanel.add(new JLabel("Type :"), c1); JLabel jobType = new JLabel(); jobType.setText(getJobType(profile.getJob())); jobInfoPanel.add(jobType, c1); addUIElement("jobs." + jobId + ".job.type", jobType); // Add to components map // Job Class Name c1.gridy = 1; c1.gridwidth = 1; jobInfoPanel.add(new JLabel("GridJob Class :"), c1); c1.gridwidth = GridBagConstraints.REMAINDER; JLabel jobClassLabel = new JLabel(); jobClassLabel.setText(profile.getJob().getClass().getName()); jobInfoPanel.add(jobClassLabel, c1); addUIElement("jobs." + jobId + ".job.class", jobClassLabel); // Add to components map /* -- Execution Information -- */ JPanel executionInfoPanel = new JPanel(); executionInfoPanel.setBorder(BorderFactory.createTitledBorder("Execution Statistics")); executionInfoPanel.setLayout(new GridBagLayout()); c.gridy = 1; c.ipady = 30; centerPanel.add(executionInfoPanel, c); GridBagConstraints c3 = new GridBagConstraints(); c3.weightx = 1; c3.weighty = 1; c3.fill = GridBagConstraints.BOTH; // Start Time executionInfoPanel.add(new JLabel("Job Status :"), c3); final JLabel statusLabel = new JLabel("Initializing"); executionInfoPanel.add(statusLabel, c3); addUIElement("jobs." + jobId + ".execution.status", statusLabel); // Add to components map // Status Update Listener profile.getFuture().addGridJobStateListener(new GridJobStateListener() { public void stateChanged(final GridJobState newState) { SwingUtilities.invokeLater(new Runnable() { public void run() { statusLabel.setText(StringUtils.capitalize(newState.toString().toLowerCase())); } }); } }); executionInfoPanel.add(new JLabel(), c3); // Space Holder // Percent Complete executionInfoPanel.add(new JLabel("Completed % :"), c3); final JLabel percentLabel = new JLabel("-N/A-"); executionInfoPanel.add(percentLabel, c3); addUIElement("jobs." + jobId + ".execution.percentage", percentLabel); // Add to components map c3.gridy = 1; // Start Time executionInfoPanel.add(new JLabel("Start Time :"), c3); JLabel startTimeLabel = new JLabel(DateFormat.getInstance().format(new Date(startTime))); executionInfoPanel.add(startTimeLabel, c3); addUIElement("jobs." + jobId + ".execution.starttime", startTimeLabel); // Add to components map executionInfoPanel.add(new JLabel(), c3); // Space Holder // Elapsed Time executionInfoPanel.add(new JLabel("Elapsed Time :"), c3); JLabel elapsedTimeLabel = new JLabel("-N/A-"); executionInfoPanel.add(elapsedTimeLabel, c3); addUIElement("jobs." + jobId + ".execution.elapsedtime", elapsedTimeLabel); // Add to components map c3.gridy = 2; // Tasks Deployed (Count) executionInfoPanel.add(new JLabel("Tasks Deployed :"), c3); JLabel tasksDeployedLabel = new JLabel("-N/A-"); executionInfoPanel.add(tasksDeployedLabel, c3); addUIElement("jobs." + jobId + ".execution.tasks", tasksDeployedLabel); // Add to components map executionInfoPanel.add(new JLabel(), c3); // Space Holder // Results Collected (Count) executionInfoPanel.add(new JLabel("Results Collected :"), c3); JLabel resultsCollectedLabel = new JLabel("-N/A-"); executionInfoPanel.add(resultsCollectedLabel, c3); addUIElement("jobs." + jobId + ".execution.results", resultsCollectedLabel); // Add to components map c3.gridy = 3; // Remaining Tasks (Count) executionInfoPanel.add(new JLabel("Remaining Tasks :"), c3); JLabel remainingTasksLabel = new JLabel("-N/A-"); executionInfoPanel.add(remainingTasksLabel, c3); addUIElement("jobs." + jobId + ".execution.remaining", remainingTasksLabel); // Add to components map executionInfoPanel.add(new JLabel(), c3); // Space Holder // Failed Tasks (Count) executionInfoPanel.add(new JLabel("Failed Tasks :"), c3); JLabel failedTasksLabel = new JLabel("-N/A-"); executionInfoPanel.add(failedTasksLabel, c3); addUIElement("jobs." + jobId + ".execution.failed", failedTasksLabel); // Add to components map /* -- Submitter Information -- */ UUID ownerId = profile.getOwner(); GridNodeDelegate owner = ClusterManager.getInstance().getClusterRegistrationService() .getGridNodeDelegate(ownerId); JPanel ownerInfoPanel = new JPanel(); ownerInfoPanel.setBorder(BorderFactory.createTitledBorder("Owner Information")); ownerInfoPanel.setLayout(new GridBagLayout()); c.gridy = 2; c.ipady = 10; centerPanel.add(ownerInfoPanel, c); GridBagConstraints c2 = new GridBagConstraints(); c2.fill = GridBagConstraints.BOTH; c2.weightx = 1; c2.weighty = 1; // Host Name ownerInfoPanel.add(new JLabel("Host Name :"), c2); JLabel hostNameLabel = new JLabel(owner.getProfile().getName()); ownerInfoPanel.add(hostNameLabel, c2); addUIElement("jobs." + jobId + ".owner.hostname", hostNameLabel); // Add to components map // Gap ownerInfoPanel.add(new JLabel(), c2); // Host IP Address ownerInfoPanel.add(new JLabel("Host IP :"), c2); JLabel hostIPLabel = new JLabel(owner.getProfile().getIpAddress()); ownerInfoPanel.add(hostIPLabel, c2); addUIElement("jobs." + jobId + ".owner.hostip", hostIPLabel); // Add to components map // Owner UUID c2.gridy = 1; c2.gridx = 0; ownerInfoPanel.add(new JLabel("Owner ID :"), c2); JLabel ownerIdLabel = new JLabel(profile.getOwner().toString()); c2.gridx = 1; c2.gridwidth = 4; ownerInfoPanel.add(ownerIdLabel, c2); addUIElement("jobs." + jobId + ".owner.id", ownerIdLabel); // Add to components map SwingUtilities.invokeLater(new Runnable() { public void run() { // Create Tab addUIElement("jobs." + jobId, jobPanel); JTabbedPane tabs = getUIElement("tabs"); tabs.addTab(profile.getJob().getClass().getSimpleName(), jobPanel); tabs.revalidate(); } }); // Execution Information Updater Thread new Thread(new Runnable() { boolean initialized = false; boolean unbounded = false; public void run() { // Unbounded, No Progress Supported if ((!initialized) && profile.getJob() instanceof UnboundedGridJob<?>) { SwingUtilities.invokeLater(new Runnable() { public void run() { progressBar.setIndeterminate(true); progressBar.setStringPainted(false); // Infinity Symbol percentLabel.setText(String.valueOf('\u221e')); } }); initialized = true; unbounded = true; } // Update Job Info while (true) { try { // 500ms Interval Thread.sleep(500); } catch (InterruptedException e) { log.warn("Interrupted Progress Updater Thread", e); } final int totalCount = profile.getTotalTasks(); final int tasksRem = profile.getTaskCount(); final int resCount = profile.getResultCount(); final int failCount = profile.getFailedCount(); showBusyIcon(); // Task Information JLabel totalTaskLabel = getUIElement("jobs." + jobId + ".execution.tasks"); totalTaskLabel.setText(String.valueOf(totalCount)); // Result Count JLabel resCountLabel = getUIElement("jobs." + jobId + ".execution.results"); resCountLabel.setText(String.valueOf(resCount)); // Remaining Task Count JLabel remLabel = getUIElement("jobs." + jobId + ".execution.remaining"); remLabel.setText(String.valueOf(tasksRem)); // Failed Task Count JLabel failedLabel = getUIElement("jobs." + jobId + ".execution.failed"); failedLabel.setText(String.valueOf(failCount)); // Elapsed Time JLabel elapsedLabel = getUIElement("jobs." + jobId + ".execution.elapsedtime"); elapsedLabel.setText(TimeUtils.timeDifference(startTime)); // Job State final JLabel statusLabel = getUIElement("jobs." + jobId + ".execution.status"); // If not in Executing Mode if ((!profile.getFuture().isJobFinished()) && profile.getFuture().getState() != GridJobState.EXECUTING) { SwingUtilities.invokeLater(new Runnable() { public void run() { // Progress Bar progressBar.setIndeterminate(true); progressBar.setStringPainted(false); // Status Text String state = profile.getFuture().getState().toString(); statusLabel.setText(StringUtils.capitalize(state.toLowerCase())); // Percentage Label percentLabel.setText(String.valueOf('\u221e')); } }); } else { // Executing Mode : Progress Information // Job Finished, Stop if (profile.getFuture().isJobFinished()) { showIdleIcon(); return; } // Double check for status label if (!statusLabel.getText().equalsIgnoreCase("executing")) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { String newstate = profile.getFuture().getState().toString(); statusLabel.setText(StringUtils.capitalize(newstate.toLowerCase())); } }); } if (!unbounded) { final int percentage = (int) (profile.percentage() * 100); //final int failCount = profile.get SwingUtilities.invokeLater(new Runnable() { public void run() { // If finished at this point, do not update if (progressBar.getValue() == 100) { return; } // If ProgressBar is in indeterminate if (progressBar.isIndeterminate()) { progressBar.setIndeterminate(false); progressBar.setStringPainted(true); } // Update Progress Bar / Percent Label progressBar.setValue(percentage); percentLabel.setText(percentage + " %"); } }); } } } } }).start(); // Job End Hook to Execute Job End Actions ServiceEventsSupport.addServiceHook(new ServiceHookCallback() { public void onServiceEvent(final ServiceMessage event) { SwingUtilities.invokeLater(new Runnable() { public void run() { JButton close = getUIElement("jobs." + jobId + ".closetab"); JButton terminate = getUIElement("jobs." + jobId + ".terminate"); terminate.setEnabled(false); close.setEnabled(true); JProgressBar progress = getUIElement("jobs." + jobId + ".progress"); JLabel percentage = getUIElement("jobs." + jobId + ".execution.percentage"); progress.setEnabled(false); // If Successfully Finished if (event.getType() == ServiceMessageType.JOB_END) { if (profile.getFuture().getState() != GridJobState.FAILED) { // If Not Job Failed progress.setValue(100); percentage.setText("100 %"); } else { // If Failed percentage.setText("N/A"); } // Stop (if) Indeterminate Progress Bar if (progress.isIndeterminate()) { progress.setIndeterminate(false); progress.setStringPainted(true); } } else if (event.getType() == ServiceMessageType.JOB_CANCEL) { if (progress.isIndeterminate()) { progress.setIndeterminate(false); progress.setStringPainted(false); percentage.setText("N/A"); } } showIdleIcon(); } }); } }, jobId, ServiceMessageType.JOB_CANCEL, ServiceMessageType.JOB_END); }
From source file:junk.gui.HazardSpectrumApplication.java
private void jbInit() throws Exception { border1 = BorderFactory.createLineBorder(SystemColor.controlText, 1); border2 = BorderFactory.createLineBorder(SystemColor.controlText, 1); border3 = BorderFactory.createEmptyBorder(); border4 = BorderFactory.createLineBorder(SystemColor.controlText, 1); border5 = BorderFactory.createLineBorder(SystemColor.controlText, 1); border6 = BorderFactory.createBevelBorder(BevelBorder.RAISED, Color.white, Color.white, new Color(98, 98, 112), new Color(140, 140, 161)); border7 = BorderFactory.createBevelBorder(BevelBorder.RAISED, Color.white, Color.white, new Color(98, 98, 112), new Color(140, 140, 161)); border8 = BorderFactory.createBevelBorder(BevelBorder.RAISED, Color.white, Color.white, new Color(98, 98, 112), new Color(140, 140, 161)); //this.getContentPane().setBackground(Color.white); this.setSize(new Dimension(1100, 670)); this.getContentPane().setLayout(borderLayout1); jPanel1.setLayout(gridBagLayout10);/* w w w . ja va2s .c o m*/ //creating the Object the GraphPaenl class graphPanel = new GraphPanel(this); jPanel1.setBackground(Color.white); jPanel1.setBorder(border4); jPanel1.setMinimumSize(new Dimension(959, 600)); jPanel1.setPreferredSize(new Dimension(959, 600)); //loading the OpenSHA Logo topSplitPane.setOrientation(JSplitPane.VERTICAL_SPLIT); clearButton.setText("Clear Plot"); clearButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { clearButton_actionPerformed(e); } }); imgLabel.setText(""); imgLabel.setIcon(new ImageIcon(FileUtils.loadImage(this.POWERED_BY_IMAGE))); imgLabel.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(MouseEvent e) { imgLabel_mouseClicked(e); } }); //jCheckylog.setBackground(Color.white); //jCheckylog.setForeground(new Color(80, 80, 133)); //buttonPanel.setBackground(Color.white); buttonPanel.setMinimumSize(new Dimension(568, 20)); buttonPanel.setLayout(flowLayout1); //progressCheckBox.setBackground(Color.white); progressCheckBox.setFont(new java.awt.Font("Dialog", 1, 12)); //progressCheckBox.setForeground(new Color(80, 80, 133)); progressCheckBox.setSelected(true); progressCheckBox.setText("Show Progress Bar"); addButton.setText("Compute"); addButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { addButton_actionPerformed(e); } }); // jCheckxlog.setBackground(Color.white); //jCheckxlog.setForeground(new Color(80, 80, 133)); //controlComboBox.setBackground(new Color(200, 200, 230)); //controlComboBox.setForeground(new Color(80, 80, 133)); controlComboBox.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { controlComboBox_actionPerformed(e); } }); panel.setLayout(gridBagLayout9); panel.setBackground(Color.white); panel.setBorder(border5); panel.setMinimumSize(new Dimension(0, 0)); imrSplitPane.setOrientation(JSplitPane.VERTICAL_SPLIT); imrSplitPane.setBottomComponent(imtPanel); imrSplitPane.setTopComponent(imrPanel); erfSplitPane.setTopComponent(erfPanel); sitePanel.setLayout(gridBagLayout13); sitePanel.setBackground(Color.white); imtPanel.setLayout(gridBagLayout8); imtPanel.setBackground(Color.white); controlsSplit.setDividerSize(5); erfPanel.setLayout(gridBagLayout5); erfPanel.setBackground(Color.white); erfPanel.setBorder(border2); erfPanel.setMaximumSize(new Dimension(2147483647, 10000)); erfPanel.setMinimumSize(new Dimension(2, 300)); erfPanel.setPreferredSize(new Dimension(2, 300)); imrPanel.setLayout(gridBagLayout15); imrPanel.setBackground(Color.white); chartSplit.setLeftComponent(panel); chartSplit.setRightComponent(paramsTabbedPane); probDeterSelection.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { probDeterSelection_actionPerformed(e); } }); peelOffButton.setText("Peel Off"); peelOffButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { peelOffButton_actionPerformed(e); } }); this.getContentPane().add(jPanel1, BorderLayout.CENTER); jPanel1.add(topSplitPane, new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(11, 4, 5, 6), 243, 231)); buttonPanel.add(probDeterSelection, null); buttonPanel.add(controlComboBox, null); buttonPanel.add(addButton, null); buttonPanel.add(clearButton, null); buttonPanel.add(peelOffButton, null); buttonPanel.add(progressCheckBox, null); buttonPanel.add(imgLabel, null); topSplitPane.add(chartSplit, JSplitPane.TOP); chartSplit.add(panel, JSplitPane.LEFT); chartSplit.add(paramsTabbedPane, JSplitPane.RIGHT); imrSplitPane.add(imrPanel, JSplitPane.TOP); imrSplitPane.add(imtPanel, JSplitPane.BOTTOM); controlsSplit.add(imrSplitPane, JSplitPane.LEFT); paramsTabbedPane.add(controlsSplit, "IMR, IML/Prob, & Site"); controlsSplit.add(sitePanel, JSplitPane.RIGHT); paramsTabbedPane.add(erfSplitPane, "ERF & Time Span"); erfSplitPane.add(erfPanel, JSplitPane.LEFT); topSplitPane.add(buttonPanel, JSplitPane.BOTTOM); topSplitPane.setDividerLocation(600); imrSplitPane.setDividerLocation(300); erfSplitPane.setDividerLocation(260); controlsSplit.setDividerLocation(260); erfPanel.validate(); erfPanel.repaint(); chartSplit.setDividerLocation(600); }
From source file:org.openconcerto.erp.core.sales.credit.component.AvoirClientSQLComponent.java
private JPanel getBottomPanel() { // UI// w w w .j a v a 2 s . c om final JPanel panel = new JPanel(new GridBagLayout()); panel.setOpaque(false); final GridBagConstraints c = new DefaultGridBagConstraints(); c.anchor = GridBagConstraints.NORTHWEST; c.weightx = 1; // Colonne 1 this.boxAdeduire.setOpaque(false); this.boxAdeduire.setMinimumSize(new Dimension(430, this.boxAdeduire.getPreferredSize().height)); this.boxAdeduire.setPreferredSize(new Dimension(430, this.boxAdeduire.getPreferredSize().height)); panel.add(this.boxAdeduire, c); this.addView("ID_MODE_REGLEMENT", DEC + ";" + SEP); this.eltModeRegl = (ElementSQLObject) this.getView("ID_MODE_REGLEMENT"); c.gridy++; c.fill = GridBagConstraints.NONE; c.weighty = 1; this.eltModeRegl.setOpaque(false); panel.add(this.eltModeRegl, c); // Colonne 2 : port et remise final JPanel panelPortEtRemise = new JPanel(); panelPortEtRemise.setOpaque(false); panelPortEtRemise.setLayout(new GridBagLayout()); final GridBagConstraints cFrais = new DefaultGridBagConstraints(); DeviseField textPortHT = new DeviseField(5); DeviseField textRemiseHT = new DeviseField(5); // Frais de port cFrais.gridheight = 1; cFrais.fill = GridBagConstraints.VERTICAL; cFrais.weighty = 1; cFrais.gridx = 1; // FIXME implmenter la remise et les port pour les avoirs JLabel labelPortHT = new JLabel(getLabelFor("PORT_HT")); labelPortHT.setHorizontalAlignment(SwingConstants.RIGHT); cFrais.gridy++; // panelPortEtRemise.add(labelPortHT, cFrais); cFrais.gridx++; DefaultGridBagConstraints.lockMinimumSize(textPortHT); // panelPortEtRemise.add(textPortHT, cFrais); // Remise JLabel labelRemiseHT = new JLabel(getLabelFor("REMISE_HT")); labelRemiseHT.setHorizontalAlignment(SwingConstants.RIGHT); cFrais.gridy++; cFrais.gridx = 1; // panelPortEtRemise.add(labelRemiseHT, cFrais); cFrais.gridx++; DefaultGridBagConstraints.lockMinimumSize(textRemiseHT); // panelPortEtRemise.add(textRemiseHT, cFrais); cFrais.gridy++; c.gridx++; c.gridy = 0; c.gridheight = 2; c.weightx = 0; c.fill = GridBagConstraints.HORIZONTAL; c.anchor = GridBagConstraints.NORTHWEST; panel.add(panelPortEtRemise, c); // Colonne 3 : totaux final DeviseField fieldHT = new DeviseField(); final DeviseField fieldTVA = new DeviseField(); final DeviseField fieldService = new DeviseField(); final DeviseField fieldTTC = new DeviseField(); // SQL addSQLObject(textPortHT, "PORT_HT"); final DeviseField fieldDevise = new DeviseField(); if (getTable().getFieldsName().contains("T_DEVISE")) addSQLObject(fieldDevise, "T_DEVISE"); addSQLObject(textRemiseHT, "REMISE_HT"); addRequiredSQLObject(fieldHT, "MONTANT_HT"); addRequiredSQLObject(fieldTVA, "MONTANT_TVA"); addRequiredSQLObject(fieldTTC, "MONTANT_TTC"); addRequiredSQLObject(fieldService, "MONTANT_SERVICE"); // JTextField poids = new JTextField(); if (getTable().getFieldsName().contains("T_POIDS")) addSQLObject(poids, "T_POIDS"); final TotalPanel totalTTC = new TotalPanel(this.table, fieldHT, fieldTVA, fieldTTC, textPortHT, textRemiseHT, fieldService, null, fieldDevise, poids, null); totalTTC.setOpaque(false); c.gridx++; c.gridy = 0; c.gridheight = 2; c.fill = GridBagConstraints.BOTH; panel.add(totalTTC, c); // Listeners textPortHT.getDocument().addDocumentListener(new DocumentListener() { public void changedUpdate(DocumentEvent e) { totalTTC.updateTotal(); } public void removeUpdate(DocumentEvent e) { totalTTC.updateTotal(); } public void insertUpdate(DocumentEvent e) { totalTTC.updateTotal(); } }); textRemiseHT.getDocument().addDocumentListener(new DocumentListener() { public void changedUpdate(DocumentEvent e) { totalTTC.updateTotal(); } public void removeUpdate(DocumentEvent e) { totalTTC.updateTotal(); } public void insertUpdate(DocumentEvent e) { totalTTC.updateTotal(); } }); return panel; }
From source file:de.tor.tribes.ui.views.DSWorkbenchConquersFrame.java
/** * This method is called from within the constructor to initialize the form. WARNING: Do NOT modify this code. The content of this * method is always regenerated by the Form Editor. *//*ww w . j av a 2 s .c o m*/ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; jConquersPanel = new javax.swing.JPanel(); jConquerTablePanel = new org.jdesktop.swingx.JXPanel(); infoPanel = new org.jdesktop.swingx.JXCollapsiblePane(); jXLabel1 = new org.jdesktop.swingx.JXLabel(); jScrollPane4 = new javax.swing.JScrollPane(); jXPanel2 = new org.jdesktop.swingx.JXPanel(); jSeparator1 = new javax.swing.JSeparator(); jLastUpdateLabel = new javax.swing.JLabel(); jGreyConquersLabel = new javax.swing.JLabel(); jFriendlyConquersLabel = new javax.swing.JLabel(); jSelfConquersLabel = new javax.swing.JLabel(); jxFilterPane = new org.jdesktop.swingx.JXPanel(); jXPanel3 = new org.jdesktop.swingx.JXPanel(); jButton12 = new javax.swing.JButton(); jTextField1 = new javax.swing.JTextField(); jLabel21 = new javax.swing.JLabel(); jFilterRows = new javax.swing.JCheckBox(); jFilterCaseSensitive = new javax.swing.JCheckBox(); jScrollPane1 = new javax.swing.JScrollPane(); jXColumnList = new org.jdesktop.swingx.JXList(); jLabel22 = new javax.swing.JLabel(); jConquersFrameAlwaysOnTop = new javax.swing.JCheckBox(); jConquerPanel = new org.jdesktop.swingx.JXPanel(); capabilityInfoPanel1 = new de.tor.tribes.ui.components.CapabilityInfoPanel(); jConquersPanel.setBackground(new java.awt.Color(239, 235, 223)); jConquersPanel.setLayout(new java.awt.BorderLayout()); jConquerTablePanel.setLayout(new java.awt.BorderLayout()); infoPanel.setCollapsed(true); infoPanel.setInheritAlpha(false); jXLabel1.setText("Keine Meldung"); jXLabel1.setOpaque(true); jXLabel1.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseReleased(java.awt.event.MouseEvent evt) { fireHideInfoEvent(evt); } }); infoPanel.add(jXLabel1, java.awt.BorderLayout.CENTER); jConquerTablePanel.add(infoPanel, java.awt.BorderLayout.SOUTH); jConquersTable .setModel(new javax.swing.table.DefaultTableModel( new Object[][] { { null, null, null, null }, { null, null, null, null }, { null, null, null, null }, { null, null, null, null } }, new String[] { "Title 1", "Title 2", "Title 3", "Title 4" })); jScrollPane4.setViewportView(jConquersTable); jConquerTablePanel.add(jScrollPane4, java.awt.BorderLayout.CENTER); jConquersPanel.add(jConquerTablePanel, java.awt.BorderLayout.CENTER); jXPanel2.setOpaque(false); jXPanel2.setLayout(new java.awt.GridBagLayout()); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; gridBagConstraints.insets = new java.awt.Insets(10, 0, 10, 0); jXPanel2.add(jSeparator1, gridBagConstraints); jLastUpdateLabel.setText("Letzte Aktualisierung:"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; gridBagConstraints.insets = new java.awt.Insets(0, 5, 5, 5); jXPanel2.add(jLastUpdateLabel, gridBagConstraints); jGreyConquersLabel.setBackground(new java.awt.Color(255, 204, 204)); jGreyConquersLabel.setText("Grau-Adelungen:"); jGreyConquersLabel.setOpaque(true); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; gridBagConstraints.insets = new java.awt.Insets(0, 5, 5, 5); jXPanel2.add(jGreyConquersLabel, gridBagConstraints); jFriendlyConquersLabel.setBackground(new java.awt.Color(0, 255, 255)); jFriendlyConquersLabel.setText("Aufadelungen:"); jFriendlyConquersLabel.setOpaque(true); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 3; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; gridBagConstraints.insets = new java.awt.Insets(0, 5, 5, 5); jXPanel2.add(jFriendlyConquersLabel, gridBagConstraints); jSelfConquersLabel.setBackground(new java.awt.Color(213, 255, 128)); jSelfConquersLabel.setText("Selbstadelungen:"); jSelfConquersLabel.setOpaque(true); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 4; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; gridBagConstraints.insets = new java.awt.Insets(0, 5, 5, 5); jXPanel2.add(jSelfConquersLabel, gridBagConstraints); jConquersPanel.add(jXPanel2, java.awt.BorderLayout.SOUTH); jxFilterPane.setOpaque(false); jxFilterPane.setLayout(new java.awt.GridBagLayout()); jXPanel3.setBorder(javax.swing.BorderFactory.createEtchedBorder()); jXPanel3.setInheritAlpha(false); jButton12.setText("Anwenden"); jButton12.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseReleased(java.awt.event.MouseEvent evt) { jButton12fireHideGlassPaneEvent(evt); } }); jTextField1.addCaretListener(new javax.swing.event.CaretListener() { public void caretUpdate(javax.swing.event.CaretEvent evt) { jTextField1fireHighlightEvent(evt); } }); jLabel21.setText("Suchbegriff"); jFilterRows.setText("Nur gefilterte Zeilen anzeigen"); jFilterRows.addChangeListener(new javax.swing.event.ChangeListener() { public void stateChanged(javax.swing.event.ChangeEvent evt) { jFilterRowsfireUpdateFilterEvent(evt); } }); jFilterCaseSensitive.setText("Gro-/Kleinschreibung beachten"); jFilterCaseSensitive.addChangeListener(new javax.swing.event.ChangeListener() { public void stateChanged(javax.swing.event.ChangeEvent evt) { jFilterCaseSensitivefireUpdateFilterEvent(evt); } }); jXColumnList.setModel(new javax.swing.AbstractListModel() { String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" }; public int getSize() { return strings.length; } public Object getElementAt(int i) { return strings[i]; } }); jXColumnList.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); jScrollPane1.setViewportView(jXColumnList); jLabel22.setText("Spalten"); javax.swing.GroupLayout jXPanel3Layout = new javax.swing.GroupLayout(jXPanel3); jXPanel3.setLayout(jXPanel3Layout); jXPanel3Layout .setHorizontalGroup(jXPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jXPanel3Layout.createSequentialGroup().addContainerGap().addGroup(jXPanel3Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jLabel22, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent( jLabel21, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGap(18, 18, 18) .addGroup(jXPanel3Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jXPanel3Layout.createSequentialGroup() .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 158, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addGroup(jXPanel3Layout .createParallelGroup( javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(jXPanel3Layout.createParallelGroup( javax.swing.GroupLayout.Alignment.TRAILING, false) .addComponent(jFilterRows, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jFilterCaseSensitive, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addComponent(jButton12))) .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 355, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); jXPanel3Layout.setVerticalGroup(jXPanel3Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jXPanel3Layout.createSequentialGroup().addContainerGap().addGroup(jXPanel3Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(jLabel21) .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jXPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jXPanel3Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jXPanel3Layout .createSequentialGroup().addComponent(jFilterCaseSensitive) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jFilterRows) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jButton12)) .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 164, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(jLabel22)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); jxFilterPane.add(jXPanel3, new java.awt.GridBagConstraints()); setTitle("Eroberungen"); getContentPane().setLayout(new java.awt.GridBagLayout()); jConquersFrameAlwaysOnTop.setText("Immer im Vordergrund"); jConquersFrameAlwaysOnTop.addChangeListener(new javax.swing.event.ChangeListener() { public void stateChanged(javax.swing.event.ChangeEvent evt) { fireConquersFrameAlwaysOnTopEvent(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5); getContentPane().add(jConquersFrameAlwaysOnTop, gridBagConstraints); jConquerPanel.setBackground(new java.awt.Color(239, 235, 223)); jConquerPanel.setLayout(new java.awt.BorderLayout()); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.ipadx = 661; gridBagConstraints.ipady = 354; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; getContentPane().add(jConquerPanel, gridBagConstraints); capabilityInfoPanel1.setBbSupport(false); capabilityInfoPanel1.setCopyable(false); capabilityInfoPanel1.setDeletable(false); capabilityInfoPanel1.setPastable(false); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5); getContentPane().add(capabilityInfoPanel1, gridBagConstraints); pack(); }
From source file:com.openbravo.pos.sales.JRetailTicketPreviewTicket.java
/** This method is called from within the constructor to * initialize the form./* w w w . ja v a 2s .c o m*/ * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; buttonGroup1 = new javax.swing.ButtonGroup(); m_jOptions = new javax.swing.JPanel(); m_jButtons = new javax.swing.JPanel(); m_jTicketId = new javax.swing.JLabel(); jButtonSearch = new javax.swing.JButton(); // m_jEdit = new javax.swing.JButton(); m_jRefund = new javax.swing.JButton(); m_jPrint = new javax.swing.JButton(); jPanel2 = new javax.swing.JPanel(); m_jPanelTicket = new javax.swing.JPanel(); jPanel3 = new javax.swing.JPanel(); jPanel4 = new javax.swing.JPanel(); // m_jKeys = new com.openbravo.editor.JEditorKeys(); // jPanel5 = new javax.swing.JPanel(); jButton1 = new javax.swing.JButton(); // m_jTicketEditor = new com.openbravo.editor.JEditorIntegerPositive(); jPanel1 = new javax.swing.JPanel(); // jrbSales = new javax.swing.JRadioButton(); // jrbRefunds = new javax.swing.JRadioButton(); setLayout(new java.awt.BorderLayout()); m_jOptions.setLayout(new java.awt.BorderLayout()); m_jButtons.setPreferredSize(new java.awt.Dimension(506, 56)); m_jButtons.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); m_jTicketId.setBackground(java.awt.Color.white); m_jTicketId.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); m_jTicketId.setBorder(javax.swing.BorderFactory.createCompoundBorder( javax.swing.BorderFactory .createLineBorder(javax.swing.UIManager.getDefaults().getColor("Button.darkShadow")), javax.swing.BorderFactory.createEmptyBorder(1, 4, 1, 4))); m_jTicketId.setOpaque(true); m_jTicketId.setPreferredSize(new java.awt.Dimension(160, 25)); m_jTicketId.setRequestFocusEnabled(false); m_jButtons.add(m_jTicketId, new org.netbeans.lib.awtextra.AbsoluteConstraints(5, 15, -1, 30)); jButtonSearch.setBackground(new java.awt.Color(255, 255, 255)); jButtonSearch .setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/openbravo/images/search.png"))); // NOI18N jButtonSearch.setText(AppLocal.getIntString("label.search")); // NOI18N jButtonSearch.setFocusPainted(false); jButtonSearch.setFocusable(false); jButtonSearch.setMargin(new java.awt.Insets(0, 0, 0, 0)); jButtonSearch.setRequestFocusEnabled(false); jButtonSearch.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButtonSearchActionPerformed(evt); } }); m_jButtons.add(jButtonSearch, new org.netbeans.lib.awtextra.AbsoluteConstraints(170, 12, 85, 35)); // m_jEdit.setBackground(new java.awt.Color(255, 255, 255)); // m_jEdit.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/openbravo/images/edit.png"))); // NOI18N // m_jEdit.setText(AppLocal.getIntString("button.edit")); // NOI18N // m_jEdit.setFocusPainted(false); // m_jEdit.setFocusable(false); // m_jEdit.setMargin(new java.awt.Insets(8, 14, 8, 14)); // m_jEdit.setRequestFocusEnabled(false); // m_jEdit.addActionListener(new java.awt.event.ActionListener() { // public void actionPerformed(java.awt.event.ActionEvent evt) { // m_jEditActionPerformed(evt); // } // }); // m_jButtons.add(m_jEdit, new org.netbeans.lib.awtextra.AbsoluteConstraints(258, 12, 85, 35)); // m_jRefund.setBackground(new java.awt.Color(255, 255, 255)); // m_jRefund.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/openbravo/images/inbox.png"))); // NOI18N // m_jRefund.setText(AppLocal.getIntString("button.refund")); // NOI18N // m_jRefund.setFocusPainted(false); // m_jRefund.setFocusable(false); // m_jRefund.setMargin(new java.awt.Insets(8, 14, 8, 14)); // m_jRefund.setRequestFocusEnabled(false); // m_jRefund.addActionListener(new java.awt.event.ActionListener() { // public void actionPerformed(java.awt.event.ActionEvent evt) { // m_jRefundActionPerformed(evt); // } // }); // m_jButtons.add(m_jRefund, new org.netbeans.lib.awtextra.AbsoluteConstraints(450, 10, 50, 35)); m_jPrint.setBackground(new java.awt.Color(255, 255, 255)); m_jPrint.setIcon( new javax.swing.ImageIcon(getClass().getResource("/com/openbravo/images/yast_printer.png"))); // NOI18N m_jPrint.setText(AppLocal.getIntString("button.print")); // NOI18N m_jPrint.setFocusPainted(false); m_jPrint.setFocusable(false); m_jPrint.setMargin(new java.awt.Insets(0, 0, 0, 0)); m_jPrint.setRequestFocusEnabled(false); m_jPrint.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { m_jPrintActionPerformed(evt); } }); m_jButtons.add(m_jPrint, new org.netbeans.lib.awtextra.AbsoluteConstraints(258, 12, 85, 35)); m_jOptions.add(m_jButtons, java.awt.BorderLayout.WEST); jPanel2.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT)); m_jOptions.add(jPanel2, java.awt.BorderLayout.CENTER); add(m_jOptions, java.awt.BorderLayout.NORTH); m_jPanelTicket.setBorder(javax.swing.BorderFactory.createEmptyBorder(5, 5, 5, 5)); m_jPanelTicket.setLayout(new java.awt.BorderLayout()); add(m_jPanelTicket, java.awt.BorderLayout.CENTER); jPanel3.setLayout(new java.awt.BorderLayout()); jPanel4.setPreferredSize(new java.awt.Dimension(175, 276)); jPanel4.setLayout(new javax.swing.BoxLayout(jPanel4, javax.swing.BoxLayout.Y_AXIS)); // m_jKeys.addActionListener(new java.awt.event.ActionListener() { // public void actionPerformed(java.awt.event.ActionEvent evt) { // m_jKeysActionPerformed(evt); // } // }); // jPanel4.add(m_jKeys); // jPanel5.setBorder(javax.swing.BorderFactory.createEmptyBorder(5, 5, 5, 5)); // jPanel5.setPreferredSize(new java.awt.Dimension(201, 60)); // jPanel5.setLayout(new java.awt.GridBagLayout()); // jButton1.setBackground(new java.awt.Color(255, 255, 255)); // jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/openbravo/images/button_ok.png"))); // NOI18N // jButton1.setFocusPainted(false); // jButton1.setFocusable(false); // jButton1.setMargin(new java.awt.Insets(8, 14, 8, 14)); // jButton1.setRequestFocusEnabled(false); // jButton1.addActionListener(new java.awt.event.ActionListener() { // public void actionPerformed(java.awt.event.ActionEvent evt) { // jButton1ActionPerformed(evt); // } // }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 0; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; gridBagConstraints.insets = new java.awt.Insets(0, 5, 0, 0); // jPanel5.add(jButton1, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; // jPanel5.add(m_jTicketEditor, gridBagConstraints); // jPanel4.add(jPanel5); jPanel3.add(jPanel4, java.awt.BorderLayout.NORTH); jPanel1.setPreferredSize(new java.awt.Dimension(130, 25)); // buttonGroup1.add(jrbSales); // jrbSales.setText(AppLocal.getIntString("label.sales")); // NOI18N // jrbSales.setFocusPainted(false); // jrbSales.setFocusable(false); // jrbSales.setRequestFocusEnabled(false); // jPanel1.add(jrbSales); // buttonGroup1.add(jrbRefunds); // jrbRefunds.setText(AppLocal.getIntString("label.refunds")); // NOI18N // jrbRefunds.setFocusPainted(false); // jrbRefunds.setFocusable(false); // jrbRefunds.setRequestFocusEnabled(false); // jPanel1.add(jrbRefunds); jPanel3.add(jPanel1, java.awt.BorderLayout.CENTER); add(jPanel3, java.awt.BorderLayout.EAST); }
From source file:ca.uhn.hl7v2.testpanel.ui.TestPanelWindow.java
/** * Initialize the contents of the frame. *///from ww w .j ava 2 s .c om private void initialize() { myframe = new JFrame(); myframe.setVisible(false); List<Image> l = new ArrayList<Image>(); l.add(Toolkit.getDefaultToolkit() .getImage(TestPanelWindow.class.getResource("/ca/uhn/hl7v2/testpanel/images/hapi_16.png"))); l.add(Toolkit.getDefaultToolkit() .getImage(TestPanelWindow.class.getResource("/ca/uhn/hl7v2/testpanel/images/hapi_64.png"))); myframe.setIconImages(l); myframe.setTitle("HAPI TestPanel"); myframe.setBounds(100, 100, 796, 603); myframe.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); myframe.addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent theE) { myController.close(); } }); JMenuBar menuBar = new JMenuBar(); myframe.setJMenuBar(menuBar); JMenu mnFile = new JMenu("File"); mnFile.setMnemonic('f'); menuBar.add(mnFile); JMenuItem mntmExit = new JMenuItem("Exit"); mntmExit.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { myController.close(); } }); JMenuItem mntmNewMessage = new JMenuItem("New Message..."); mntmNewMessage.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { myController.addMessage(); } }); mntmNewMessage.setIcon( new ImageIcon(TestPanelWindow.class.getResource("/ca/uhn/hl7v2/testpanel/images/message_hl7.png"))); mnFile.add(mntmNewMessage); mySaveMenuItem = new JMenuItem("Save"); mySaveMenuItem.setAccelerator( KeyStroke.getKeyStroke(KeyEvent.VK_S, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask())); mySaveMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { doSaveMessages(); } }); mnFile.add(mySaveMenuItem); mySaveAsMenuItem = new JMenuItem("Save As..."); mySaveAsMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { doSaveMessagesAs(); } }); mnFile.add(mySaveAsMenuItem); mymenuItem_3 = new JMenuItem("Open"); mymenuItem_3.setAccelerator( KeyStroke.getKeyStroke(KeyEvent.VK_O, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask())); mymenuItem_3.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { myController.openMessages(); } }); myRevertToSavedMenuItem = new JMenuItem("Revert to Saved"); myRevertToSavedMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { myController.revertMessage((Hl7V2MessageCollection) myController.getLeftSelectedItem()); } }); mnFile.add(myRevertToSavedMenuItem); mnFile.add(mymenuItem_3); myRecentFilesMenu = new JMenu("Open Recent"); mnFile.add(myRecentFilesMenu); JSeparator separator = new JSeparator(); mnFile.add(separator); mnFile.add(mntmExit); JMenu mnNewMenu = new JMenu("View"); mnNewMenu.setMnemonic('v'); menuBar.add(mnNewMenu); myShowLogConsoleMenuItem = new JMenuItem("Show Log Console"); myShowLogConsoleMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { Prefs.getInstance().setShowLogConsole(!Prefs.getInstance().getShowLogConsole()); updateLogScrollPaneVisibility(); myframe.validate(); } }); mnNewMenu.add(myShowLogConsoleMenuItem); mymenu_1 = new JMenu("Test"); menuBar.add(mymenu_1); mymenuItem_1 = new JMenuItem("Populate TestPanel with Sample Message and Connections..."); mymenuItem_1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { myController.populateWithSampleMessageAndConnections(); } }); mymenu_1.add(mymenuItem_1); mymenu_3 = new JMenu("Tools"); menuBar.add(mymenu_3); mnHl7V2FileDiff = new JMenuItem("HL7 v2 File Diff..."); mnHl7V2FileDiff.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (myHl7V2FileDiff == null) { myHl7V2FileDiff = new Hl7V2FileDiffController(myController); } myHl7V2FileDiff.show(); } }); mymenu_3.add(mnHl7V2FileDiff); mymenuItem_5 = new JMenuItem("HL7 v2 File Sort..."); mymenuItem_5.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (myHl7V2FileSort == null) { myHl7V2FileSort = new Hl7V2FileSortController(myController); } myHl7V2FileSort.show(); } }); mymenu_3.add(mymenuItem_5); mymenu_2 = new JMenu("Conformance"); menuBar.add(mymenu_2); mymenuItem_2 = new JMenuItem("Profiles and Tables..."); mymenuItem_2.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { myController.showProfilesAndTablesEditor(); } }); mymenu_2.add(mymenuItem_2); mymenu = new JMenu("Help"); mymenu.setMnemonic('H'); menuBar.add(mymenu); mymenuItem = new JMenuItem("About HAPI TestPanel..."); mymenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { showAboutDialog(); } }); mymenuItem.setIcon( new ImageIcon(TestPanelWindow.class.getResource("/ca/uhn/hl7v2/testpanel/images/hapi_16.png"))); mymenu.add(mymenuItem); mymenuItem_4 = new JMenuItem("Licenses..."); mymenuItem_4.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { new LicensesDialog().setVisible(true); } }); mymenu.add(mymenuItem_4); myframe.getContentPane().setLayout(new BorderLayout(0, 0)); JSplitPane outerSplitPane = new JSplitPane(); outerSplitPane.setBorder(null); myframe.getContentPane().add(outerSplitPane); JSplitPane leftSplitPane = new JSplitPane(); leftSplitPane.setOrientation(JSplitPane.VERTICAL_SPLIT); outerSplitPane.setLeftComponent(leftSplitPane); JPanel messagesPanel = new JPanel(); leftSplitPane.setLeftComponent(messagesPanel); GridBagLayout gbl_messagesPanel = new GridBagLayout(); gbl_messagesPanel.columnWidths = new int[] { 110, 0 }; gbl_messagesPanel.rowHeights = new int[] { 20, 30, 118, 0, 0 }; gbl_messagesPanel.columnWeights = new double[] { 1.0, Double.MIN_VALUE }; gbl_messagesPanel.rowWeights = new double[] { 0.0, 0.0, 100.0, 1.0, Double.MIN_VALUE }; messagesPanel.setLayout(gbl_messagesPanel); JLabel lblMessages = new JLabel("Messages"); GridBagConstraints gbc_lblMessages = new GridBagConstraints(); gbc_lblMessages.insets = new Insets(0, 0, 5, 0); gbc_lblMessages.gridx = 0; gbc_lblMessages.gridy = 0; messagesPanel.add(lblMessages, gbc_lblMessages); JToolBar messagesToolBar = new JToolBar(); messagesToolBar.setFloatable(false); messagesToolBar.setRollover(true); messagesToolBar.setAlignmentX(Component.LEFT_ALIGNMENT); GridBagConstraints gbc_messagesToolBar = new GridBagConstraints(); gbc_messagesToolBar.insets = new Insets(0, 0, 5, 0); gbc_messagesToolBar.weightx = 1.0; gbc_messagesToolBar.anchor = GridBagConstraints.NORTHWEST; gbc_messagesToolBar.gridx = 0; gbc_messagesToolBar.gridy = 1; messagesPanel.add(messagesToolBar, gbc_messagesToolBar); JButton msgOpenButton = new JButton(""); msgOpenButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { myController.openMessages(); } }); myAddMessageButton = new JButton(""); myAddMessageButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { myController.addMessage(); } }); myAddMessageButton.setIcon( new ImageIcon(TestPanelWindow.class.getResource("/ca/uhn/hl7v2/testpanel/images/add.png"))); myAddMessageButton.setToolTipText("New Message"); myAddMessageButton.setBorderPainted(false); myAddMessageButton.addMouseListener(new HoverButtonMouseAdapter(myAddMessageButton)); messagesToolBar.add(myAddMessageButton); myDeleteMessageButton = new JButton(""); myDeleteMessageButton.setToolTipText("Close Selected Message"); myDeleteMessageButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { myController.closeMessage((Hl7V2MessageCollection) myController.getLeftSelectedItem()); } }); myDeleteMessageButton.setBorderPainted(false); myDeleteMessageButton.addMouseListener(new HoverButtonMouseAdapter(myDeleteMessageButton)); myDeleteMessageButton.setIcon( new ImageIcon(TestPanelWindow.class.getResource("/ca/uhn/hl7v2/testpanel/images/close.png"))); messagesToolBar.add(myDeleteMessageButton); msgOpenButton.setBorderPainted(false); msgOpenButton.setToolTipText("Open Messages from File"); msgOpenButton.setIcon( new ImageIcon(TestPanelWindow.class.getResource("/ca/uhn/hl7v2/testpanel/images/open.png"))); msgOpenButton.addMouseListener(new HoverButtonMouseAdapter(msgOpenButton)); messagesToolBar.add(msgOpenButton); myMsgSaveButton = new JButton(""); myMsgSaveButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { doSaveMessages(); } }); myMsgSaveButton.setBorderPainted(false); myMsgSaveButton.setToolTipText("Save Selected Messages to File"); myMsgSaveButton.setIcon( new ImageIcon(TestPanelWindow.class.getResource("/ca/uhn/hl7v2/testpanel/images/save.png"))); myMsgSaveButton.addMouseListener(new HoverButtonMouseAdapter(myMsgSaveButton)); messagesToolBar.add(myMsgSaveButton); myMessagesList = new JList(); myMessagesList.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { if (myMessagesList.getSelectedIndex() >= 0) { ourLog.debug("New messages selection " + myMessagesList.getSelectedIndex()); myController.setLeftSelectedItem(myMessagesList.getSelectedValue()); myOutboundConnectionsList.clearSelection(); myOutboundConnectionsList.repaint(); myInboundConnectionsList.clearSelection(); myInboundConnectionsList.repaint(); } updateLeftToolbarButtons(); } }); GridBagConstraints gbc_MessagesList = new GridBagConstraints(); gbc_MessagesList.gridheight = 2; gbc_MessagesList.weightx = 1.0; gbc_MessagesList.weighty = 1.0; gbc_MessagesList.fill = GridBagConstraints.BOTH; gbc_MessagesList.gridx = 0; gbc_MessagesList.gridy = 2; messagesPanel.add(myMessagesList, gbc_MessagesList); JPanel connectionsPanel = new JPanel(); leftSplitPane.setRightComponent(connectionsPanel); GridBagLayout gbl_connectionsPanel = new GridBagLayout(); gbl_connectionsPanel.columnWidths = new int[] { 194, 0 }; gbl_connectionsPanel.rowHeights = new int[] { 0, 30, 0, 0, 0, 0, 0 }; gbl_connectionsPanel.columnWeights = new double[] { 1.0, Double.MIN_VALUE }; gbl_connectionsPanel.rowWeights = new double[] { 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, Double.MIN_VALUE }; connectionsPanel.setLayout(gbl_connectionsPanel); JLabel lblConnections = new JLabel("Sending Connections"); lblConnections.setHorizontalAlignment(SwingConstants.CENTER); GridBagConstraints gbc_lblConnections = new GridBagConstraints(); gbc_lblConnections.insets = new Insets(0, 0, 5, 0); gbc_lblConnections.anchor = GridBagConstraints.NORTH; gbc_lblConnections.fill = GridBagConstraints.HORIZONTAL; gbc_lblConnections.gridx = 0; gbc_lblConnections.gridy = 0; connectionsPanel.add(lblConnections, gbc_lblConnections); JToolBar toolBar = new JToolBar(); toolBar.setFloatable(false); GridBagConstraints gbc_toolBar = new GridBagConstraints(); gbc_toolBar.insets = new Insets(0, 0, 5, 0); gbc_toolBar.anchor = GridBagConstraints.NORTH; gbc_toolBar.fill = GridBagConstraints.HORIZONTAL; gbc_toolBar.gridx = 0; gbc_toolBar.gridy = 1; connectionsPanel.add(toolBar, gbc_toolBar); myAddConnectionButton = new JButton(""); myAddConnectionButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { myController.addOutboundConnection(); } }); myAddConnectionButton.setBorderPainted(false); myAddConnectionButton.addMouseListener(new HoverButtonMouseAdapter(myAddConnectionButton)); myAddConnectionButton.setBorder(null); myAddConnectionButton.setToolTipText("New Connection"); myAddConnectionButton.setIcon( new ImageIcon(TestPanelWindow.class.getResource("/ca/uhn/hl7v2/testpanel/images/add.png"))); toolBar.add(myAddConnectionButton); myDeleteOutboundConnectionButton = new JButton(""); myDeleteOutboundConnectionButton.setToolTipText("Delete Selected Connection"); myDeleteOutboundConnectionButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (myController.getLeftSelectedItem() instanceof OutboundConnection) { myController.removeOutboundConnection((OutboundConnection) myController.getLeftSelectedItem()); } } }); myDeleteOutboundConnectionButton.setBorderPainted(false); myDeleteOutboundConnectionButton .addMouseListener(new HoverButtonMouseAdapter(myDeleteOutboundConnectionButton)); myDeleteOutboundConnectionButton.setIcon( new ImageIcon(TestPanelWindow.class.getResource("/ca/uhn/hl7v2/testpanel/images/delete.png"))); toolBar.add(myDeleteOutboundConnectionButton); myStartOneOutboundButton = new JButton(""); myStartOneOutboundButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (myController.getLeftSelectedItem() instanceof OutboundConnection) { myController.startOutboundConnection((OutboundConnection) myController.getLeftSelectedItem()); } } }); myStartOneOutboundButton.setBorderPainted(false); myStartOneOutboundButton.setToolTipText("Start selected connection"); myStartOneOutboundButton.setIcon( new ImageIcon(TestPanelWindow.class.getResource("/ca/uhn/hl7v2/testpanel/images/start_one.png"))); myStartOneOutboundButton.addMouseListener(new HoverButtonMouseAdapter(myStartOneOutboundButton)); toolBar.add(myStartOneOutboundButton); myStartAllOutboundButton = new JButton(""); myStartAllOutboundButton.setBorderPainted(false); myStartAllOutboundButton.setToolTipText("Start all sending connections"); myStartAllOutboundButton.setIcon( new ImageIcon(TestPanelWindow.class.getResource("/ca/uhn/hl7v2/testpanel/images/start_all.png"))); myStartAllOutboundButton.addMouseListener(new HoverButtonMouseAdapter(myStartAllOutboundButton)); myStartAllOutboundButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent theE) { myController.startAllOutboundConnections(); } }); toolBar.add(myStartAllOutboundButton); myStopAllOutboundButton = new JButton(""); myStopAllOutboundButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { myController.stopAllOutboundConnections(); } }); myStopAllOutboundButton.setIcon( new ImageIcon(TestPanelWindow.class.getResource("/ca/uhn/hl7v2/testpanel/images/stop_all.png"))); myStopAllOutboundButton.setToolTipText("Stop all sending connections"); myStopAllOutboundButton.setBorderPainted(false); myStopAllOutboundButton.addMouseListener(new HoverButtonMouseAdapter(myStopAllOutboundButton)); toolBar.add(myStopAllOutboundButton); JScrollPane scrollPane = new JScrollPane(); scrollPane.setBorder(null); GridBagConstraints gbc_scrollPane = new GridBagConstraints(); gbc_scrollPane.fill = GridBagConstraints.BOTH; gbc_scrollPane.insets = new Insets(0, 0, 5, 0); gbc_scrollPane.gridx = 0; gbc_scrollPane.gridy = 2; connectionsPanel.add(scrollPane, gbc_scrollPane); myOutboundConnectionsList = new JList(); myOutboundConnectionsList.setBorder(null); myOutboundConnectionsList.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { if (myOutboundConnectionsList.getSelectedIndex() >= 0) { ourLog.debug( "New outbound connection selection " + myOutboundConnectionsList.getSelectedIndex()); myController.setLeftSelectedItem(myOutboundConnectionsList.getSelectedValue()); myMessagesList.clearSelection(); myMessagesList.repaint(); myInboundConnectionsList.clearSelection(); myInboundConnectionsList.repaint(); } updateLeftToolbarButtons(); } }); scrollPane.setViewportView(myOutboundConnectionsList); JLabel lblReceivingConnections = new JLabel("Receiving Connections"); lblReceivingConnections.setHorizontalAlignment(SwingConstants.CENTER); GridBagConstraints gbc_lblReceivingConnections = new GridBagConstraints(); gbc_lblReceivingConnections.insets = new Insets(0, 0, 5, 0); gbc_lblReceivingConnections.gridx = 0; gbc_lblReceivingConnections.gridy = 3; connectionsPanel.add(lblReceivingConnections, gbc_lblReceivingConnections); JToolBar toolBar_1 = new JToolBar(); toolBar_1.setFloatable(false); GridBagConstraints gbc_toolBar_1 = new GridBagConstraints(); gbc_toolBar_1.anchor = GridBagConstraints.WEST; gbc_toolBar_1.insets = new Insets(0, 0, 5, 0); gbc_toolBar_1.gridx = 0; gbc_toolBar_1.gridy = 4; connectionsPanel.add(toolBar_1, gbc_toolBar_1); myAddInboundConnectionButton = new JButton(""); myAddInboundConnectionButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { myController.addInboundConnection(); } }); myAddInboundConnectionButton.setIcon( new ImageIcon(TestPanelWindow.class.getResource("/ca/uhn/hl7v2/testpanel/images/add.png"))); myAddInboundConnectionButton.setToolTipText("New Connection"); myAddInboundConnectionButton.setBorderPainted(false); myAddInboundConnectionButton.addMouseListener(new HoverButtonMouseAdapter(myAddInboundConnectionButton)); toolBar_1.add(myAddInboundConnectionButton); myDeleteInboundConnectionButton = new JButton(""); myDeleteInboundConnectionButton.setToolTipText("Delete Selected Connection"); myDeleteInboundConnectionButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (myController.getLeftSelectedItem() instanceof InboundConnection) { myController.removeInboundConnection((InboundConnection) myController.getLeftSelectedItem()); } } }); myDeleteInboundConnectionButton.setBorderPainted(false); myDeleteInboundConnectionButton .addMouseListener(new HoverButtonMouseAdapter(myDeleteInboundConnectionButton)); myDeleteInboundConnectionButton.setIcon( new ImageIcon(TestPanelWindow.class.getResource("/ca/uhn/hl7v2/testpanel/images/delete.png"))); toolBar_1.add(myDeleteInboundConnectionButton); myStartOneInboundButton = new JButton(""); myStartOneInboundButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (myController.getLeftSelectedItem() instanceof InboundConnection) { myController.startInboundConnection((InboundConnection) myController.getLeftSelectedItem()); } } }); myStartOneInboundButton.setBorderPainted(false); myStartOneInboundButton.setToolTipText("Start selected connection"); myStartOneInboundButton.setIcon( new ImageIcon(TestPanelWindow.class.getResource("/ca/uhn/hl7v2/testpanel/images/start_one.png"))); myStartOneInboundButton.addMouseListener(new HoverButtonMouseAdapter(myStartOneInboundButton)); toolBar_1.add(myStartOneInboundButton); myStartAllInboundButton = new JButton(""); myStartAllInboundButton.setBorderPainted(false); myStartAllInboundButton.setToolTipText("Start all receiving connections"); myStartAllInboundButton.setIcon( new ImageIcon(TestPanelWindow.class.getResource("/ca/uhn/hl7v2/testpanel/images/start_all.png"))); myStartAllInboundButton.addMouseListener(new HoverButtonMouseAdapter(myStartAllInboundButton)); myStartAllInboundButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent theE) { myController.startAllInboundConnections(); } }); toolBar_1.add(myStartAllInboundButton); myStopAllInboundButton = new JButton(""); myStopAllInboundButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { myController.stopAllInboundConnections(); } }); myStopAllInboundButton.setIcon( new ImageIcon(TestPanelWindow.class.getResource("/ca/uhn/hl7v2/testpanel/images/stop_all.png"))); myStopAllInboundButton.setToolTipText("Stop all receiving connections"); myStopAllInboundButton.setBorderPainted(false); myStopAllInboundButton.addMouseListener(new HoverButtonMouseAdapter(myStopAllInboundButton)); toolBar_1.add(myStopAllInboundButton); JScrollPane scrollPane_1 = new JScrollPane(); scrollPane_1.setBorder(null); GridBagConstraints gbc_scrollPane_1 = new GridBagConstraints(); gbc_scrollPane_1.fill = GridBagConstraints.BOTH; gbc_scrollPane_1.gridx = 0; gbc_scrollPane_1.gridy = 5; connectionsPanel.add(scrollPane_1, gbc_scrollPane_1); myInboundConnectionsList = new JList(); myInboundConnectionsList.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { if (myInboundConnectionsList.getSelectedIndex() >= 0) { ourLog.debug("New inbound connection selection " + myInboundConnectionsList.getSelectedIndex()); myController.setLeftSelectedItem(myInboundConnectionsList.getSelectedValue()); myMessagesList.clearSelection(); myMessagesList.repaint(); myOutboundConnectionsList.clearSelection(); myOutboundConnectionsList.repaint(); myInboundConnectionsList.repaint(); } updateLeftToolbarButtons(); } }); scrollPane_1.setViewportView(myInboundConnectionsList); leftSplitPane.setDividerLocation(200); myWorkspacePanel = new JPanel(); myWorkspacePanel.setBorder(null); outerSplitPane.setRightComponent(myWorkspacePanel); myWorkspacePanel.setLayout(new BorderLayout(0, 0)); outerSplitPane.setDividerLocation(200); myLogScrollPane = new LogTable(); myLogScrollPane.setPreferredSize(new Dimension(454, 120)); myLogScrollPane.setMaximumSize(new Dimension(32767, 120)); myframe.getContentPane().add(myLogScrollPane, BorderLayout.SOUTH); updateLogScrollPaneVisibility(); updateLeftToolbarButtons(); }
From source file:com.sec.ose.osi.ui.frm.main.report.JPanExportReport.java
private JPanel getJPanelCreatorInfo() { if (jPanelCreatorInfo == null) { jPanelCreatorInfo = new JPanel(); jPanelCreatorInfo.setLayout(new GridBagLayout()); jLabelList[CREATOR_NAME] = new JLabel("* Creator Name:", JLabel.RIGHT); mandatoryField[CREATOR_NAME] = true; jLabelList[CREATOR_EMAIL] = new JLabel("* Creator Email:", JLabel.RIGHT); mandatoryField[CREATOR_EMAIL] = true; jLabelList[ORGANIZATION_NAME] = new JLabel("* Organization Name:", JLabel.RIGHT); mandatoryField[ORGANIZATION_NAME] = true; // Creator Name GridBagConstraints gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridy = CREATOR_NAME; gridBagConstraints.gridx = 0;//from w w w .ja v a 2 s . c o m gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints.insets = new Insets(0, 5, 0, 0); jPanelCreatorInfo.add(jLabelList[CREATOR_NAME], gridBagConstraints); GridBagConstraints gridBagConstraints1 = new GridBagConstraints(); gridBagConstraints1.fill = GridBagConstraints.BOTH; gridBagConstraints1.gridy = CREATOR_NAME; gridBagConstraints1.gridx = 1; gridBagConstraints1.weightx = 1.0; gridBagConstraints1.insets = new Insets(0, 5, 0, 5); jPanelCreatorInfo.add(getJTextFieldCreatorName(), gridBagConstraints1); // Creator Email GridBagConstraints gridBagConstraints2 = new GridBagConstraints(); gridBagConstraints2.gridy = CREATOR_EMAIL; gridBagConstraints2.gridx = 0; gridBagConstraints2.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints2.insets = new Insets(0, 5, 0, 0); jPanelCreatorInfo.add(jLabelList[CREATOR_EMAIL], gridBagConstraints2); GridBagConstraints gridBagConstraints3 = new GridBagConstraints(); gridBagConstraints3.fill = GridBagConstraints.BOTH; gridBagConstraints3.gridy = CREATOR_EMAIL; gridBagConstraints3.gridx = 1; gridBagConstraints3.weightx = 1.0; gridBagConstraints3.insets = new Insets(5, 5, 0, 5); jPanelCreatorInfo.add(getJTextFieldCreatorEmail(), gridBagConstraints3); // Organization Name GridBagConstraints gridBagConstraints4 = new GridBagConstraints(); gridBagConstraints4.gridy = ORGANIZATION_NAME; gridBagConstraints4.gridx = 0; gridBagConstraints4.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints4.insets = new Insets(0, 5, 0, 0); jPanelCreatorInfo.add(jLabelList[ORGANIZATION_NAME], gridBagConstraints4); GridBagConstraints gridBagConstraints5 = new GridBagConstraints(); gridBagConstraints5.fill = GridBagConstraints.BOTH; gridBagConstraints5.gridy = ORGANIZATION_NAME; gridBagConstraints5.gridx = 1; gridBagConstraints5.weightx = 1.0; gridBagConstraints5.insets = new Insets(5, 5, 0, 5); jPanelCreatorInfo.add(getJTextFieldOrganizationName(), gridBagConstraints5); } return jPanelCreatorInfo; }