List of usage examples for javax.swing JLabel setFont
@BeanProperty(preferred = true, visualUpdate = true, description = "The font for the component.") public void setFont(Font font)
From source file:Interfaz.rubiktimer.java
private void cargarArchivoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cargarArchivoActionPerformed // TODO add your handling code here: if (listaT.primero == null) { JOptionPane.showMessageDialog(null, "El archivo a cargar debe ser un archivo que se guardo en la Opcion (Guardar Datos Para Cargar) y no de la opcion (Guardar Datos Para Usuario), si se intenta cargar un archivo de usuario no se cargara ningun dato", "Informacin", JOptionPane.INFORMATION_MESSAGE); CargarDat ventanaVisualizar = new CargarDat(); ventanaVisualizar.cargArchivo(listaT, lista5mej, lista10mej); actualizar_estad();/*from w w w . jav a 2s .c o m*/ Lista nueva = new Lista(); nueva = listaT; Nodo actual; actual = nueva.primero; while ((actual != null)) { JLabel nuevo_tiempo = new JLabel(actual.getDato_string()); nuevo_tiempo.setFont(new java.awt.Font("Lucida Sans", 0, 25)); nuevo_tiempo.setForeground(Color.yellow); JButton eliminar = new JButton("Eliminar Tiempo"); eliminar.setFocusable(false); JButton Penalizacion = new JButton("Penalizacion +2"); Penalizacion.setFocusable(false); JButton DNF = new JButton("DNF"); DNF.setFocusable(false); /*if (tipoCubScramble == 0) { Scramble_parametro = Scramble; } else { Scramble_parametro = Scramble4x4; }*/ JLabel nuevo_Scramble = new JLabel(actual.getScramble()); nuevo_Scramble.setFont(new java.awt.Font("Lucida Sans", 0, 15)); nuevo_Scramble.setForeground(Color.white); panel.add(nuevo_tiempo); panel.add(nuevo_Scramble); panel.add(eliminar); panel.add(Penalizacion); panel.add(DNF); panel.updateUI(); funcionalidad_botones(nuevo_tiempo, nuevo_Scramble, eliminar, Penalizacion, DNF); actual = actual.enlace; } actualizarGrafica(); System.out.println("LISTAAAAAAAAA LOOOOOOL "); System.out.println(listaT.primero.getDato_string()); } else { JOptionPane.showMessageDialog(null, "No puede guardar en un documento una Sesion VACIA", "Sesion Vacia", JOptionPane.INFORMATION_MESSAGE); } }
From source file:com.juanhg.angularmdisk.AngularMDiskApplet.java
private void autogeneratedCode() { JPanel panel_control = new JPanel(); panel_control.setBorder(new CompoundBorder(new EtchedBorder(EtchedBorder.RAISED, null, null), new BevelBorder(BevelBorder.RAISED, null, null, null, null))); JPanel panelInputs = new JPanel(); panelInputs.setToolTipText(""); panelInputs.setBorder(new MatteBorder(1, 1, 1, 1, (Color) new Color(0, 0, 0))); JPanel panelTiempo = new JPanel(); panelTiempo.setToolTipText(""); panelTiempo.setBorder(new MatteBorder(1, 1, 1, 1, (Color) new Color(0, 0, 0))); btnPhase1 = new JButton("Lanzar Insecto"); btnPhase1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { btnPhase1Event();/*from ww w.ja v a 2 s. co m*/ } }); btnPhase1.setEnabled(false); JPanel panelOutputs = new JPanel(); panelOutputs.setToolTipText(""); panelOutputs.setBorder(new MatteBorder(1, 1, 1, 1, (Color) new Color(0, 0, 0))); JPanel panelTitleOutputs = new JPanel(); panelTitleOutputs.setBorder(new BevelBorder(BevelBorder.RAISED, null, null, null, null)); JLabel labelOutputData = new JLabel("Datos de la Simulaci\u00F3n"); labelOutputData.setFont(new Font("Tahoma", Font.PLAIN, 14)); panelTitleOutputs.add(labelOutputData); lblDiskW = new JLabel("Velocidad Disco:"); lblDiskW.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblDiskWValue = new JLabel(); lblDiskWValue.setText("0"); lblDiskWValue.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblCriticRadius = new JLabel("Radio Cr\u00EDtico:"); lblCriticRadius.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblCriticRadiusValue = new JLabel(); lblCriticRadiusValue.setText("0"); lblCriticRadiusValue.setFont(new Font("Tahoma", Font.PLAIN, 14)); GroupLayout gl_panelOutputs = new GroupLayout(panelOutputs); gl_panelOutputs.setHorizontalGroup(gl_panelOutputs.createParallelGroup(Alignment.LEADING) .addComponent(panelTitleOutputs, GroupLayout.DEFAULT_SIZE, 394, Short.MAX_VALUE) .addGroup(gl_panelOutputs.createSequentialGroup().addContainerGap() .addGroup(gl_panelOutputs.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelOutputs.createSequentialGroup() .addComponent(lblCriticRadius, GroupLayout.PREFERRED_SIZE, 119, GroupLayout.PREFERRED_SIZE) .addGap(6)) .addGroup(gl_panelOutputs.createSequentialGroup() .addComponent(lblDiskW, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGap(26))) .addGroup(gl_panelOutputs.createParallelGroup(Alignment.LEADING) .addComponent(lblDiskWValue, GroupLayout.PREFERRED_SIZE, 147, GroupLayout.PREFERRED_SIZE) .addComponent(lblCriticRadiusValue, GroupLayout.PREFERRED_SIZE, 147, GroupLayout.PREFERRED_SIZE)) .addContainerGap(112, Short.MAX_VALUE))); gl_panelOutputs .setVerticalGroup(gl_panelOutputs.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelOutputs.createSequentialGroup() .addComponent(panelTitleOutputs, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.UNRELATED) .addGroup(gl_panelOutputs.createParallelGroup(Alignment.BASELINE) .addComponent(lblDiskW).addComponent(lblDiskWValue)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_panelOutputs.createParallelGroup(Alignment.BASELINE) .addComponent(lblCriticRadius, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE) .addComponent(lblCriticRadiusValue, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE)) .addGap(121))); panelOutputs.setLayout(gl_panelOutputs); panel_1 = new JPanel(); panel_1.setBorder(new LineBorder(new Color(0, 0, 0))); GroupLayout gl_panel_control = new GroupLayout(panel_control); gl_panel_control.setHorizontalGroup(gl_panel_control.createParallelGroup(Alignment.LEADING) .addGroup(gl_panel_control.createSequentialGroup().addContainerGap().addGroup(gl_panel_control .createParallelGroup(Alignment.LEADING) .addGroup(gl_panel_control.createSequentialGroup() .addGroup(gl_panel_control.createParallelGroup(Alignment.TRAILING) .addComponent(panelInputs, GroupLayout.PREFERRED_SIZE, 396, GroupLayout.PREFERRED_SIZE) .addComponent(panelOutputs, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 396, Short.MAX_VALUE) .addComponent(panelTiempo, GroupLayout.DEFAULT_SIZE, 396, Short.MAX_VALUE)) .addGap(18)) .addGroup(gl_panel_control.createSequentialGroup() .addComponent(panel_1, GroupLayout.PREFERRED_SIZE, 397, GroupLayout.PREFERRED_SIZE) .addContainerGap(17, Short.MAX_VALUE))))); gl_panel_control.setVerticalGroup(gl_panel_control.createParallelGroup(Alignment.LEADING) .addGroup(gl_panel_control.createSequentialGroup().addContainerGap() .addComponent(panelInputs, GroupLayout.PREFERRED_SIZE, 202, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(panelOutputs, GroupLayout.PREFERRED_SIZE, 103, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(panelTiempo, GroupLayout.PREFERRED_SIZE, 210, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED, 15, Short.MAX_VALUE).addComponent(panel_1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addContainerGap())); JLabel lblNewLabel = new JLabel("GNU GENERAL PUBLIC LICENSE"); panel_1.add(lblNewLabel); rdbtnCam1 = new JRadioButton("C\u00E1mara Fija"); rdbtnCam1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { rdbtnCam1Event(); } }); rdbtnCam1.setSelected(true); rdbtnCam2 = new JRadioButton("C\u00E1mara M\u00F3vil"); rdbtnCam2.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { rdbtnCam2Event(); } }); btnLaunchSimulation = new JButton("Iniciar"); btnLaunchSimulation.setFont(new Font("Tahoma", Font.PLAIN, 16)); btnLaunchSimulation.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { btnLaunchSimulationEvent(event); } }); btnPauseContinue = new JButton("Pausar"); btnPauseContinue.setFont(new Font("Tahoma", Font.PLAIN, 16)); btnPauseContinue.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { btnPauseContinueEvent(event); } }); panel = new JPanel(); panel.setBorder(new BevelBorder(BevelBorder.RAISED, null, null, null, null)); label = new JLabel("Datos de la Simulaci\u00F3n"); label.setFont(new Font("Tahoma", Font.PLAIN, 14)); panel.add(label); GroupLayout gl_panelTiempo = new GroupLayout(panelTiempo); gl_panelTiempo.setHorizontalGroup(gl_panelTiempo.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelTiempo.createSequentialGroup().addContainerGap() .addGroup(gl_panelTiempo.createParallelGroup(Alignment.LEADING, false) .addComponent(btnPhase1, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(btnLaunchSimulation, GroupLayout.DEFAULT_SIZE, 176, Short.MAX_VALUE)) .addGroup(gl_panelTiempo.createParallelGroup(Alignment.LEADING).addGroup(gl_panelTiempo .createSequentialGroup().addGap(52) .addGroup(gl_panelTiempo.createParallelGroup(Alignment.LEADING) .addComponent(rdbtnCam2).addComponent(rdbtnCam1, GroupLayout.PREFERRED_SIZE, 113, GroupLayout.PREFERRED_SIZE))) .addGroup(gl_panelTiempo.createSequentialGroup().addGap(21).addComponent( btnPauseContinue, GroupLayout.PREFERRED_SIZE, 168, GroupLayout.PREFERRED_SIZE))) .addContainerGap(47, Short.MAX_VALUE)) .addComponent(panel, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, 394, Short.MAX_VALUE)); gl_panelTiempo.setVerticalGroup(gl_panelTiempo.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelTiempo.createSequentialGroup() .addComponent(panel, GroupLayout.PREFERRED_SIZE, 31, GroupLayout.PREFERRED_SIZE).addGap(22) .addGroup(gl_panelTiempo.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelTiempo.createSequentialGroup().addComponent(rdbtnCam1) .addPreferredGap(ComponentPlacement.RELATED).addComponent(rdbtnCam2)) .addComponent(btnPhase1, GroupLayout.PREFERRED_SIZE, 58, GroupLayout.PREFERRED_SIZE)) .addGap(18) .addGroup(gl_panelTiempo.createParallelGroup(Alignment.LEADING) .addComponent(btnPauseContinue, GroupLayout.PREFERRED_SIZE, 62, GroupLayout.PREFERRED_SIZE) .addComponent(btnLaunchSimulation, GroupLayout.PREFERRED_SIZE, 62, GroupLayout.PREFERRED_SIZE)))); panelTiempo.setLayout(gl_panelTiempo); JLabel LabelBugMass = new JLabel("Masa del Insecto"); LabelBugMass.setFont(new Font("Tahoma", Font.PLAIN, 14)); JLabel labelFallRadio = new JLabel("Radio de Ca\u00EDda"); labelFallRadio.setFont(new Font("Tahoma", Font.PLAIN, 14)); JLabel labelBugVelocity = new JLabel("Velocidad del Insecto"); labelBugVelocity.setFont(new Font("Tahoma", Font.PLAIN, 14)); JLabel labelDiskVelocity = new JLabel("Velocidad del Disco"); labelDiskVelocity.setFont(new Font("Tahoma", Font.PLAIN, 14)); JPanel panelTitle = new JPanel(); panelTitle.setBorder(new BevelBorder(BevelBorder.RAISED, null, null, null, null)); lblFallRadiusValue = new JLabel("10"); lblFallRadiusValue.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblBugVelocityValue = new JLabel("1"); lblBugVelocityValue.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblVelocityValue = new JLabel("0.5"); lblVelocityValue.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblInitMassValue = new JLabel("30"); lblInitMassValue.setFont(new Font("Tahoma", Font.PLAIN, 14)); sliderBugInitMass = new JSlider(); sliderBugInitMass.setValue(30); sliderBugInitMass.setMinimum(20); sliderBugInitMass.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent event) { sliderBugInitMassEvent(); } }); sliderBugInitMass.setMaximum(70); sliderFallRadius = new JSlider(); sliderFallRadius.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { sliderFallRadiusEvent(); } }); sliderFallRadius.setValue(10); sliderFallRadius.setMinorTickSpacing(1); sliderFallRadius.setMaximum(20); sliderBugVelocity = new JSlider(); sliderBugVelocity.setValue(10); sliderBugVelocity.setMaximum(20); sliderBugVelocity.setMinimum(5); sliderBugVelocity.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { sliderBugVelocityEvent(); } }); sliderBugVelocity.setMinorTickSpacing(1); sliderDiskVelocity = new JSlider(); sliderDiskVelocity.setMaximum(10); sliderDiskVelocity.setMinimum(1); sliderDiskVelocity.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { sliderDiskVelocityEvent(); } }); sliderDiskVelocity.setValue(5); sliderDiskVelocity.setMinorTickSpacing(1); JLabel lblCoeficienteDeRozamiento = new JLabel("Coef de Rozamiento"); lblCoeficienteDeRozamiento.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblFrictionValue = new JLabel("0.25"); lblFrictionValue.setFont(new Font("Tahoma", Font.PLAIN, 14)); sliderFriction = new JSlider(); sliderFriction.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent arg0) { sliderFrictionEvent(); } }); sliderFriction.setValue(25); sliderFriction.setMinorTickSpacing(1); sliderFriction.setMinimum(1); sliderFriction.setMaximum(90); GroupLayout gl_panelInputs = new GroupLayout(panelInputs); gl_panelInputs.setHorizontalGroup(gl_panelInputs.createParallelGroup(Alignment.TRAILING) .addGroup(gl_panelInputs.createSequentialGroup().addContainerGap() .addGroup(gl_panelInputs.createParallelGroup(Alignment.TRAILING, false) .addComponent(labelBugVelocity, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(LabelBugMass, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(labelFallRadio, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 120, Short.MAX_VALUE)) .addGap(18) .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING) .addComponent(lblInitMassValue, GroupLayout.PREFERRED_SIZE, 42, GroupLayout.PREFERRED_SIZE) .addComponent(lblFallRadiusValue, GroupLayout.PREFERRED_SIZE, 56, GroupLayout.PREFERRED_SIZE) .addComponent(lblBugVelocityValue, GroupLayout.PREFERRED_SIZE, 56, GroupLayout.PREFERRED_SIZE)) .addGap(18) .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING) .addComponent(sliderFallRadius, GroupLayout.PREFERRED_SIZE, 146, GroupLayout.PREFERRED_SIZE) .addComponent(sliderBugInitMass, GroupLayout.PREFERRED_SIZE, 146, GroupLayout.PREFERRED_SIZE) .addComponent(sliderBugVelocity, GroupLayout.PREFERRED_SIZE, 146, GroupLayout.PREFERRED_SIZE) .addComponent(sliderDiskVelocity, GroupLayout.PREFERRED_SIZE, 146, GroupLayout.PREFERRED_SIZE)) .addGap(26)) .addGroup(gl_panelInputs.createSequentialGroup().addContainerGap() .addGroup(gl_panelInputs.createParallelGroup(Alignment.TRAILING) .addComponent(lblCoeficienteDeRozamiento, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 133, Short.MAX_VALUE) .addComponent(labelDiskVelocity, GroupLayout.DEFAULT_SIZE, 133, Short.MAX_VALUE)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING, false) .addGroup(Alignment.TRAILING, gl_panelInputs.createSequentialGroup() .addComponent(lblVelocityValue, GroupLayout.PREFERRED_SIZE, 43, GroupLayout.PREFERRED_SIZE) .addGap(204)) .addGroup(Alignment.TRAILING, gl_panelInputs.createSequentialGroup() .addComponent(lblFrictionValue, GroupLayout.PREFERRED_SIZE, 56, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(sliderFriction, GroupLayout.PREFERRED_SIZE, 146, GroupLayout.PREFERRED_SIZE) .addGap(26)))) .addComponent(panelTitle, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 396, Short.MAX_VALUE)); gl_panelInputs.setVerticalGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelInputs.createSequentialGroup() .addComponent(panelTitle, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addGap(8) .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelInputs.createParallelGroup(Alignment.BASELINE) .addComponent(LabelBugMass).addComponent(lblInitMassValue, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE)) .addComponent(sliderBugInitMass, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelInputs.createParallelGroup(Alignment.BASELINE) .addComponent(labelFallRadio).addComponent(lblFallRadiusValue, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE)) .addComponent(sliderFallRadius, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addGap(11) .addGroup( gl_panelInputs.createParallelGroup(Alignment.LEADING).addComponent(labelBugVelocity) .addComponent(lblBugVelocityValue, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE) .addComponent(sliderBugVelocity, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.UNRELATED) .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelInputs.createParallelGroup(Alignment.BASELINE) .addComponent(labelDiskVelocity).addComponent(lblVelocityValue, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE)) .addComponent(sliderDiskVelocity, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelInputs.createSequentialGroup().addGap(12) .addGroup(gl_panelInputs.createParallelGroup(Alignment.BASELINE) .addComponent(lblCoeficienteDeRozamiento, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE) .addComponent(lblFrictionValue, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE))) .addGroup(gl_panelInputs.createSequentialGroup() .addPreferredGap(ComponentPlacement.UNRELATED).addComponent(sliderFriction, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))) .addGap(47))); JLabel lblDatosDeEntrada = new JLabel("Datos de Entrada"); lblDatosDeEntrada.setFont(new Font("Tahoma", Font.PLAIN, 14)); panelTitle.add(lblDatosDeEntrada); panelInputs.setLayout(gl_panelInputs); panel_control.setLayout(gl_panel_control); JPanel panel_visualizar = new JPanel(); GroupLayout groupLayout = new GroupLayout(getContentPane()); groupLayout.setHorizontalGroup(groupLayout.createParallelGroup(Alignment.LEADING) .addGroup(groupLayout.createSequentialGroup().addContainerGap() .addComponent(panel_control, GroupLayout.PREFERRED_SIZE, 432, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(panel_visualizar, GroupLayout.PREFERRED_SIZE, 560, GroupLayout.PREFERRED_SIZE) .addContainerGap(32, Short.MAX_VALUE))); groupLayout.setVerticalGroup(groupLayout.createParallelGroup(Alignment.TRAILING) .addGroup(groupLayout.createSequentialGroup().addContainerGap() .addGroup(groupLayout.createParallelGroup(Alignment.TRAILING) .addComponent(panel_visualizar, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 598, Short.MAX_VALUE) .addComponent(panel_control, Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 598, Short.MAX_VALUE)) .addContainerGap())); GridBagLayout gbl_panel_visualizar = new GridBagLayout(); gbl_panel_visualizar.columnWidths = new int[] { 0, 0 }; gbl_panel_visualizar.rowHeights = new int[] { 0, 0, 0 }; gbl_panel_visualizar.columnWeights = new double[] { 1.0, Double.MIN_VALUE }; gbl_panel_visualizar.rowWeights = new double[] { 1.0, 1.0, Double.MIN_VALUE }; panel_visualizar.setLayout(gbl_panel_visualizar); JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP); GridBagConstraints gbc_tabbedPane = new GridBagConstraints(); gbc_tabbedPane.gridheight = 2; gbc_tabbedPane.fill = GridBagConstraints.BOTH; gbc_tabbedPane.gridx = 0; gbc_tabbedPane.gridy = 0; panel_visualizar.add(tabbedPane, gbc_tabbedPane); panelSimulation = new JPanelGrafica(); tabbedPane.addTab("Simulacin", null, panelSimulation, null); panelSimulation.setBackground(Color.WHITE); getContentPane().setLayout(groupLayout); }
From source file:Interfaz.rubiktimer.java
@Override public void keyPressed(KeyEvent ke) { System.out.println("Pulsado"); if (verifi != 0) { if (ke.getKeyCode() == KeyEvent.VK_SPACE) { switch (verificador) { case 1: // COMIENZA SOLVE t_atras.stop();//from w w w . j av a 2 s. c o m t.start(); actualizarLabel(); verificador = 2; break; case 0: // CONTEO ATRAS t_atras.start(); actualizarLabel_atras(); verificador = 1; break; case 2: // DETENER SOLVE t.stop(); segundos_atras = aux; minutos = 0.00; if (m > 0) { minutos = 60 * (double) m; } cent_seg = (double) cs / 100; tiempo = (double) s + cent_seg + minutos; String tiempo_str = (m <= 9 ? "0" : "") + m + ":" + (s <= 9 ? "0" : "") + s + "." + (cs <= 9 ? "0" : "") + cs; JLabel nuevo_tiempo = new JLabel(tiempo_str); nuevo_tiempo.setFont(new java.awt.Font("Lucida Sans", 0, 25)); nuevo_tiempo.setForeground(Color.yellow); JButton eliminar = new JButton("Eliminar Tiempo"); eliminar.setFocusable(false); JButton Penalizacion = new JButton("Penalizacion +2"); Penalizacion.setFocusable(false); JButton DNF = new JButton("DNF"); DNF.setFocusable(false); if (tipoCubScramble == 0) { Scramble_parametro = Scramble; } else { Scramble_parametro = Scramble4x4; } JLabel nuevo_Scramble = new JLabel(Scramble_parametro); nuevo_Scramble.setFont(new java.awt.Font("Lucida Sans", 0, 15)); nuevo_Scramble.setForeground(Color.white); panel.add(nuevo_tiempo); panel.add(nuevo_Scramble); panel.add(eliminar); panel.add(Penalizacion); panel.add(DNF); panel.updateUI(); listaT.insertarCabezaLista(tiempo, tiempo_str, Scramble_parametro); //lista todos los solves lista5mej.insertarNUMmejores(5, lista5mej, tiempo, nuevo_tiempo, tiempo_str, Scramble_parametro); //lista 5 mejores lista10mej.insertarNUMmejores(10, lista10mej, tiempo, nuevo_tiempo, tiempo_str, Scramble_parametro); // lista 10 mejores actualizarGrafica(); funcionalidad_botones(nuevo_tiempo, nuevo_Scramble, eliminar, Penalizacion, DNF); System.out.println("\tLista Generada 3x3"); listaT3x3.visualizar(); System.out.println("\tLista Generada 4x4"); listaT4x4.visualizar(); System.out.println("\tLista Generada 2x2"); listaT2x2.visualizar(); System.out.println("\tLista 5 mejores"); lista5mej.visualizar(); System.out.println("\tLista 10 mejores"); lista10mej.visualizar(); actualizar_estad(); verificador = 0; m = 0; s = 0; cs = 0; //actualizarLabel(); if (tipoCubScramble == 0) { actualizarScramble(); } else { actualizarScramble4x4(); } actualizar_estad(); actualizarGrafica(); verificador = 0; break; default: break; } } } else { JOptionPane.showMessageDialog(null, "Primero se tiene que escoger una categoria de cubo", "Escoger una Categoria", JOptionPane.INFORMATION_MESSAGE); } }
From source file:com.juanhg.car.CarApplet.java
private void autogeneratedCode() { JPanel panel_control = new JPanel(); panel_control.setBorder(new CompoundBorder(new EtchedBorder(EtchedBorder.RAISED, null, null), new BevelBorder(BevelBorder.RAISED, null, null, null, null))); JPanel panelInputs = new JPanel(); panelInputs.setToolTipText(""); panelInputs.setBorder(new MatteBorder(1, 1, 1, 1, (Color) new Color(0, 0, 0))); JPanel panelOutputs = new JPanel(); panelOutputs.setToolTipText(""); panelOutputs.setBorder(new MatteBorder(1, 1, 1, 1, (Color) new Color(0, 0, 0))); JPanel panelTitleOutputs = new JPanel(); panelTitleOutputs.setBorder(new BevelBorder(BevelBorder.RAISED, null, null, null, null)); JLabel labelOutputData = new JLabel("Datos de la Simulaci\u00F3n"); labelOutputData.setFont(new Font("Tahoma", Font.PLAIN, 14)); panelTitleOutputs.add(labelOutputData); lblWc = new JLabel("Wc:"); lblWc.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblWcValue = new JLabel(); lblWcValue.setText("0"); lblWcValue.setFont(new Font("Tahoma", Font.PLAIN, 14)); JLabel lblNc = new JLabel("Ciclos:"); lblNc.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblNcValue = new JLabel(); lblNcValue.setText("0"); lblNcValue.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblO3 = new JLabel("Tmax:"); lblO3.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblTmaxValue = new JLabel(); lblTmaxValue.setText("0"); lblTmaxValue.setFont(new Font("Tahoma", Font.PLAIN, 14)); JLabel lblV = new JLabel("V:"); lblV.setFont(new Font("Tahoma", Font.PLAIN, 14)); JLabel lblP = new JLabel("P:"); lblP.setFont(new Font("Tahoma", Font.PLAIN, 14)); JLabel lblH = new JLabel("Eta:"); lblH.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblEtaValue = new JLabel(); lblEtaValue.setText("0"); lblEtaValue.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblPValue = new JLabel(); lblPValue.setText("0"); lblPValue.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblVValue = new JLabel(); lblVValue.setText("0"); lblVValue.setFont(new Font("Tahoma", Font.PLAIN, 14)); JLabel lblF = new JLabel("F:"); lblF.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblFValue = new JLabel(); lblFValue.setText("0"); lblFValue.setFont(new Font("Tahoma", Font.PLAIN, 14)); JLabel lblDist = new JLabel("Dist:"); lblDist.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblXValue = new JLabel(); lblXValue.setText("0"); lblXValue.setFont(new Font("Tahoma", Font.PLAIN, 14)); GroupLayout gl_panelOutputs = new GroupLayout(panelOutputs); gl_panelOutputs.setHorizontalGroup(gl_panelOutputs.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelOutputs.createSequentialGroup().addGroup(gl_panelOutputs .createParallelGroup(Alignment.LEADING) .addGroup(gl_panelOutputs.createSequentialGroup().addContainerGap().addGroup(gl_panelOutputs .createParallelGroup(Alignment.LEADING) .addComponent(lblNc, GroupLayout.PREFERRED_SIZE, 49, GroupLayout.PREFERRED_SIZE) .addGroup(gl_panelOutputs.createParallelGroup(Alignment.TRAILING, false) .addComponent(lblWc, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(lblP, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(lblV, GroupLayout.DEFAULT_SIZE, 59, Short.MAX_VALUE))) .addGroup(gl_panelOutputs.createParallelGroup(Alignment.LEADING, false) .addComponent(lblWcValue, GroupLayout.DEFAULT_SIZE, 92, Short.MAX_VALUE) .addComponent(lblNcValue, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(lblVValue, GroupLayout.DEFAULT_SIZE, 88, Short.MAX_VALUE) .addComponent(lblPValue, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_panelOutputs.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelOutputs.createSequentialGroup() .addComponent(lblDist, GroupLayout.PREFERRED_SIZE, 40, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED).addComponent(lblXValue, GroupLayout.DEFAULT_SIZE, 76, Short.MAX_VALUE)) .addGroup(gl_panelOutputs.createSequentialGroup() .addComponent(lblF, GroupLayout.PREFERRED_SIZE, 40, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED).addComponent(lblFValue, GroupLayout.DEFAULT_SIZE, 86, Short.MAX_VALUE)) .addGroup(gl_panelOutputs.createSequentialGroup().addComponent(lblH) .addGap(18).addComponent(lblEtaValue, GroupLayout.DEFAULT_SIZE, 79, Short.MAX_VALUE)) .addGroup(gl_panelOutputs.createSequentialGroup() .addComponent(lblO3, GroupLayout.PREFERRED_SIZE, 40, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(lblTmaxValue, GroupLayout.DEFAULT_SIZE, 76, Short.MAX_VALUE)))) .addComponent(panelTitleOutputs, GroupLayout.PREFERRED_SIZE, 299, GroupLayout.PREFERRED_SIZE)) .addContainerGap())); gl_panelOutputs.setVerticalGroup(gl_panelOutputs.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelOutputs.createSequentialGroup() .addComponent(panelTitleOutputs, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addGap(20)/* www. ja v a 2 s.c o m*/ .addGroup(gl_panelOutputs.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelOutputs.createSequentialGroup().addComponent(lblWc) .addPreferredGap(ComponentPlacement.UNRELATED).addComponent(lblNc, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE)) .addGroup(gl_panelOutputs.createSequentialGroup().addComponent(lblWcValue) .addPreferredGap(ComponentPlacement.UNRELATED).addComponent(lblNcValue, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE)) .addGroup(gl_panelOutputs.createSequentialGroup() .addGroup(gl_panelOutputs.createParallelGroup(Alignment.BASELINE) .addComponent(lblH, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE) .addComponent(lblEtaValue, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.UNRELATED) .addGroup(gl_panelOutputs.createParallelGroup(Alignment.BASELINE) .addComponent(lblO3, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE) .addComponent(lblTmaxValue, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE)))) .addGap(11) .addGroup(gl_panelOutputs.createParallelGroup(Alignment.LEADING) .addComponent(lblV, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE) .addComponent(lblVValue, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE) .addComponent(lblF, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE) .addComponent(lblFValue, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE)) .addGap(11) .addGroup(gl_panelOutputs.createParallelGroup(Alignment.LEADING) .addComponent(lblDist, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE) .addGroup(gl_panelOutputs.createParallelGroup(Alignment.BASELINE) .addComponent(lblP, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE) .addComponent(lblPValue, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE)) .addComponent(lblXValue, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE)) .addContainerGap(30, Short.MAX_VALUE))); panelOutputs.setLayout(gl_panelOutputs); JPanel panelLicense = new JPanel(); panelLicense.setBorder(new LineBorder(new Color(0, 0, 0))); JPanel panel_6 = new JPanel(); panel_6.setBorder(new LineBorder(new Color(0, 0, 0))); GroupLayout gl_panel_control = new GroupLayout(panel_control); gl_panel_control.setHorizontalGroup(gl_panel_control.createParallelGroup(Alignment.TRAILING) .addGroup(gl_panel_control.createSequentialGroup().addContainerGap().addGroup(gl_panel_control .createParallelGroup(Alignment.TRAILING) .addComponent(panelOutputs, GroupLayout.PREFERRED_SIZE, 300, GroupLayout.PREFERRED_SIZE) .addComponent(panelInputs, Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 300, Short.MAX_VALUE) .addComponent(panel_6, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 300, Short.MAX_VALUE) .addComponent(panelLicense, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 300, Short.MAX_VALUE)) .addContainerGap())); gl_panel_control.setVerticalGroup(gl_panel_control.createParallelGroup(Alignment.TRAILING) .addGroup(gl_panel_control.createSequentialGroup().addContainerGap() .addComponent(panelInputs, GroupLayout.PREFERRED_SIZE, 211, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(panelOutputs, GroupLayout.DEFAULT_SIZE, 184, Short.MAX_VALUE).addGap(18) .addComponent(panel_6, GroupLayout.PREFERRED_SIZE, 74, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED).addComponent(panelLicense, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addGap(24))); btnLaunchSimulation = new JButton("Iniciar"); btnLaunchSimulation.setFont(new Font("Tahoma", Font.PLAIN, 16)); btnLaunchSimulation.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { btnLaunchSimulationEvent(event); } }); GroupLayout gl_panel_6 = new GroupLayout(panel_6); gl_panel_6.setHorizontalGroup(gl_panel_6.createParallelGroup(Alignment.LEADING) .addGroup(gl_panel_6.createSequentialGroup().addContainerGap() .addComponent(btnLaunchSimulation, GroupLayout.DEFAULT_SIZE, 278, Short.MAX_VALUE) .addContainerGap())); gl_panel_6.setVerticalGroup(gl_panel_6.createParallelGroup(Alignment.LEADING) .addGroup(gl_panel_6 .createSequentialGroup().addContainerGap().addComponent(btnLaunchSimulation, GroupLayout.PREFERRED_SIZE, 55, GroupLayout.PREFERRED_SIZE) .addContainerGap(69, Short.MAX_VALUE))); panel_6.setLayout(gl_panel_6); JLabel lblNewLabel = new JLabel("GNU GENERAL PUBLIC LICENSE"); panelLicense.add(lblNewLabel); JLabel lblVa = new JLabel("Va"); lblVa.setFont(new Font("Tahoma", Font.PLAIN, 14)); JLabel lblR = new JLabel("R"); lblR.setFont(new Font("Tahoma", Font.PLAIN, 14)); JLabel lblMg = new JLabel("mg"); lblMg.setFont(new Font("Tahoma", Font.PLAIN, 14)); JPanel panelTitle = new JPanel(); panelTitle.setBorder(new BevelBorder(BevelBorder.RAISED, null, null, null, null)); lblRValue = new JLabel("8"); lblRValue.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblMgValue = new JLabel("10"); lblMgValue.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblVaValue = new JLabel("6"); lblVaValue.setFont(new Font("Tahoma", Font.PLAIN, 14)); sliderVa = new JSlider(); sliderVa.setMinimum(5); sliderVa.setMaximum(8); sliderVa.setMinorTickSpacing(1); sliderVa.setValue(6); sliderVa.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent event) { sliderI1Event(); } }); sliderR = new JSlider(); sliderR.setMinimum(7); sliderR.setMaximum(13); sliderR.setMinorTickSpacing(1); sliderR.setValue(8); sliderR.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { sliderI2Event(); } }); sliderMg = new JSlider(); sliderMg.setMinimum(1); sliderMg.setMaximum(20); sliderMg.setValue(10); sliderMg.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { sliderI3Event(); } }); JLabel lblIVcar = new JLabel("Velocidad"); lblIVcar.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblVcarValue = new JLabel("120"); lblVcarValue.setFont(new Font("Tahoma", Font.PLAIN, 14)); sliderVcar = new JSlider(); sliderVcar.setMinimum(1); sliderVcar.setMaximum(160); sliderVcar.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent arg0) { sliderI4Event(); } }); sliderVcar.setValue(120); sliderVcar.setMinorTickSpacing(1); sliderQc = new JSlider(); sliderQc.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent arg0) { sliderI5Event(); } }); sliderQc.setMaximum(1500); sliderQc.setMinimum(500); sliderQc.setValue(600); sliderQc.setMinorTickSpacing(100); lblQcValue = new JLabel("600"); lblQcValue.setFont(new Font("Tahoma", Font.PLAIN, 14)); JLabel lblQc = new JLabel("Qc"); lblQc.setFont(new Font("Tahoma", Font.PLAIN, 14)); GroupLayout gl_panelInputs = new GroupLayout(panelInputs); gl_panelInputs.setHorizontalGroup(gl_panelInputs.createParallelGroup(Alignment.TRAILING) .addGroup(gl_panelInputs.createSequentialGroup().addGap(20).addGroup(gl_panelInputs .createParallelGroup(Alignment.TRAILING) .addGroup(gl_panelInputs.createSequentialGroup() .addComponent(lblQc, GroupLayout.PREFERRED_SIZE, 61, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED, 24, Short.MAX_VALUE) .addComponent(lblQcValue, GroupLayout.PREFERRED_SIZE, 56, GroupLayout.PREFERRED_SIZE) .addGap(18) .addComponent(sliderQc, GroupLayout.PREFERRED_SIZE, 88, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED)) .addGroup(gl_panelInputs.createSequentialGroup().addGroup(gl_panelInputs .createParallelGroup(Alignment.LEADING) .addGroup(gl_panelInputs.createSequentialGroup().addGroup(gl_panelInputs .createParallelGroup(Alignment.TRAILING) .addComponent(lblMg, GroupLayout.DEFAULT_SIZE, 67, Short.MAX_VALUE) .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING) .addComponent(lblVa, GroupLayout.PREFERRED_SIZE, 62, GroupLayout.PREFERRED_SIZE) .addComponent(lblIVcar, Alignment.TRAILING, GroupLayout.PREFERRED_SIZE, 67, GroupLayout.PREFERRED_SIZE))) .addGap(18)) .addGroup(gl_panelInputs.createSequentialGroup() .addComponent(lblR, GroupLayout.DEFAULT_SIZE, 79, Short.MAX_VALUE) .addPreferredGap(ComponentPlacement.RELATED))) .addGroup(gl_panelInputs.createParallelGroup(Alignment.TRAILING) .addGroup(gl_panelInputs.createSequentialGroup() .addComponent(lblVcarValue, GroupLayout.PREFERRED_SIZE, 56, GroupLayout.PREFERRED_SIZE) .addGap(18) .addComponent(sliderVcar, GroupLayout.PREFERRED_SIZE, 88, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED)) .addGroup(gl_panelInputs.createSequentialGroup() .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING) .addComponent(lblVaValue, GroupLayout.PREFERRED_SIZE, 42, GroupLayout.PREFERRED_SIZE) .addComponent(lblRValue, GroupLayout.PREFERRED_SIZE, 56, GroupLayout.PREFERRED_SIZE) .addComponent(lblMgValue, GroupLayout.PREFERRED_SIZE, 56, GroupLayout.PREFERRED_SIZE)) .addGap(18).addGroup( gl_panelInputs.createParallelGroup(Alignment.LEADING, false) .addComponent(sliderVa, 0, 0, Short.MAX_VALUE) .addComponent(sliderR, 0, 0, Short.MAX_VALUE) .addComponent(sliderMg, GroupLayout.PREFERRED_SIZE, 88, GroupLayout.PREFERRED_SIZE)))))) .addGap(48)) .addComponent(panelTitle, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 315, Short.MAX_VALUE)); gl_panelInputs.setVerticalGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelInputs.createSequentialGroup() .addComponent(panelTitle, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addGap(18) .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelInputs.createSequentialGroup() .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING) .addComponent(lblVaValue, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE) .addComponent( sliderVa, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelInputs.createParallelGroup(Alignment.BASELINE) .addComponent(lblRValue, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE) .addComponent(lblR)) .addComponent(sliderR, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addGap(11) .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelInputs.createParallelGroup(Alignment.BASELINE) .addComponent(lblMgValue, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE) .addComponent(lblMg)) .addComponent(sliderMg, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))) .addComponent(lblVa)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_panelInputs.createParallelGroup(Alignment.TRAILING) .addGroup(gl_panelInputs.createParallelGroup(Alignment.BASELINE) .addComponent(lblVcarValue, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE) .addComponent(lblIVcar, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE)) .addComponent(sliderVcar, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_panelInputs.createParallelGroup(Alignment.TRAILING) .addGroup(gl_panelInputs.createParallelGroup(Alignment.BASELINE) .addComponent(lblQc, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE) .addComponent(lblQcValue, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE)) .addComponent(sliderQc, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addGap(3))); JLabel lblDatosDeEntrada = new JLabel("Datos de Entrada"); lblDatosDeEntrada.setFont(new Font("Tahoma", Font.PLAIN, 14)); panelTitle.add(lblDatosDeEntrada); panelInputs.setLayout(gl_panelInputs); panel_control.setLayout(gl_panel_control); JPanel panel_visualizar = new JPanel(); panel_visualizar.setBackground(Color.WHITE); GroupLayout groupLayout = new GroupLayout(getContentPane()); groupLayout.setHorizontalGroup(groupLayout.createParallelGroup(Alignment.LEADING) .addGroup(groupLayout.createSequentialGroup().addContainerGap() .addComponent(panel_control, GroupLayout.PREFERRED_SIZE, 325, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(panel_visualizar, GroupLayout.PREFERRED_SIZE, 688, GroupLayout.PREFERRED_SIZE) .addContainerGap(94, Short.MAX_VALUE))); groupLayout.setVerticalGroup(groupLayout.createParallelGroup(Alignment.TRAILING) .addGroup(groupLayout.createSequentialGroup().addContainerGap() .addGroup(groupLayout.createParallelGroup(Alignment.TRAILING) .addComponent(panel_visualizar, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 568, Short.MAX_VALUE) .addComponent(panel_control, GroupLayout.PREFERRED_SIZE, 568, GroupLayout.PREFERRED_SIZE)) .addContainerGap())); JPanel panel = new JPanel(); panel.setBackground(Color.WHITE); JPanel panel_1 = new JPanel(); panelPlot = new JPanelGrafica(); GroupLayout gl_panel_1 = new GroupLayout(panel_1); gl_panel_1.setHorizontalGroup( gl_panel_1.createParallelGroup(Alignment.LEADING).addGap(0, 263, Short.MAX_VALUE) .addComponent(panelPlot, GroupLayout.DEFAULT_SIZE, 263, Short.MAX_VALUE)); gl_panel_1 .setVerticalGroup(gl_panel_1.createParallelGroup(Alignment.LEADING).addGap(0, 241, Short.MAX_VALUE) .addComponent(panelPlot, GroupLayout.DEFAULT_SIZE, 241, Short.MAX_VALUE)); panel_1.setLayout(gl_panel_1); JPanel panel_2 = new JPanel(); panelMotor = new JPanelGrafica(); GroupLayout gl_panel_2 = new GroupLayout(panel_2); gl_panel_2.setHorizontalGroup(gl_panel_2.createParallelGroup(Alignment.LEADING).addComponent(panelMotor, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, 268, Short.MAX_VALUE)); gl_panel_2.setVerticalGroup(gl_panel_2.createParallelGroup(Alignment.LEADING) .addGroup(gl_panel_2.createSequentialGroup() .addComponent(panelMotor, GroupLayout.PREFERRED_SIZE, 241, GroupLayout.PREFERRED_SIZE) .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); panel_2.setLayout(gl_panel_2); GroupLayout gl_panel = new GroupLayout(panel); gl_panel.setHorizontalGroup(gl_panel.createParallelGroup(Alignment.TRAILING) .addGroup(gl_panel.createSequentialGroup().addContainerGap() .addComponent(panel_1, GroupLayout.DEFAULT_SIZE, 384, Short.MAX_VALUE) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(panel_2, GroupLayout.PREFERRED_SIZE, 258, GroupLayout.PREFERRED_SIZE) .addContainerGap())); gl_panel.setVerticalGroup(gl_panel.createParallelGroup(Alignment.LEADING) .addGroup(gl_panel.createSequentialGroup().addContainerGap() .addGroup(gl_panel.createParallelGroup(Alignment.LEADING) .addComponent(panel_1, GroupLayout.PREFERRED_SIZE, 241, GroupLayout.PREFERRED_SIZE) .addComponent(panel_2, 0, 0, Short.MAX_VALUE)) .addContainerGap())); panel.setLayout(gl_panel); JPanel panel_3 = new JPanel(); panel_3.setBackground(Color.WHITE); JPanel panel_4 = new JPanel(); panelCar = new JPanelGrafica(); GroupLayout gl_panel_4 = new GroupLayout(panel_4); gl_panel_4.setHorizontalGroup(gl_panel_4.createParallelGroup(Alignment.LEADING).addComponent(panelCar, GroupLayout.DEFAULT_SIZE, 263, Short.MAX_VALUE)); gl_panel_4.setVerticalGroup(gl_panel_4.createParallelGroup(Alignment.LEADING) .addGroup(gl_panel_4.createSequentialGroup() .addComponent(panelCar, GroupLayout.PREFERRED_SIZE, 252, GroupLayout.PREFERRED_SIZE) .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); panel_4.setLayout(gl_panel_4); GroupLayout gl_panel_3 = new GroupLayout(panel_3); gl_panel_3.setHorizontalGroup(gl_panel_3.createParallelGroup(Alignment.LEADING) .addGroup(gl_panel_3.createSequentialGroup().addContainerGap() .addComponent(panel_4, GroupLayout.DEFAULT_SIZE, 648, Short.MAX_VALUE).addContainerGap())); gl_panel_3.setVerticalGroup(gl_panel_3.createParallelGroup(Alignment.LEADING) .addGroup(gl_panel_3.createSequentialGroup().addContainerGap() .addComponent(panel_4, GroupLayout.PREFERRED_SIZE, 252, Short.MAX_VALUE) .addContainerGap())); panel_3.setLayout(gl_panel_3); GroupLayout gl_panel_visualizar = new GroupLayout(panel_visualizar); gl_panel_visualizar.setHorizontalGroup(gl_panel_visualizar.createParallelGroup(Alignment.LEADING) .addGroup(Alignment.TRAILING, gl_panel_visualizar.createSequentialGroup().addContainerGap() .addGroup(gl_panel_visualizar.createParallelGroup(Alignment.TRAILING) .addComponent(panel_3, GroupLayout.PREFERRED_SIZE, 668, GroupLayout.PREFERRED_SIZE) .addComponent(panel, GroupLayout.DEFAULT_SIZE, 668, Short.MAX_VALUE)) .addContainerGap())); gl_panel_visualizar.setVerticalGroup(gl_panel_visualizar.createParallelGroup(Alignment.LEADING) .addGroup(gl_panel_visualizar.createSequentialGroup().addContainerGap() .addComponent(panel, GroupLayout.PREFERRED_SIZE, 261, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.UNRELATED) .addComponent(panel_3, GroupLayout.DEFAULT_SIZE, 274, Short.MAX_VALUE).addContainerGap())); panel_visualizar.setLayout(gl_panel_visualizar); getContentPane().setLayout(groupLayout); }
From source file:com.xilinx.kintex7.MainScreen.java
private Container createContentPane() { JPanel contentPane = new JPanel(); contentPane.setLayout(new BorderLayout()); contentPane.setOpaque(true);//from ww w . ja va2 s . c o m mainPanel = new JPanel(new BorderLayout()); mainPanel.setBounds(0, 0, minWidth, minHeight); testPanel = new JPanel(new BorderLayout()); testPanel.add(testAndStats(), BorderLayout.CENTER); mainPanel.add(testPanel, BorderLayout.LINE_START); //Make the center component big, since that's the //typical usage of BorderLayout. tabs = new JTabbedPane(); mainPanel.add(tabs, BorderLayout.CENTER); tabs.add("System Monitor", pciInfo()); tabs.add("Performance Plots", plotPanel()); mainPanel.setOpaque(true); try { imagePanel = new ImageBackgroundPanel(blockDiagram, false); } catch (Exception e) { } /*imagePanel.setBorder(BorderFactory.createCompoundBorder( BorderFactory.createTitledBorder("Design Block Diagram"), BorderFactory.createEmptyBorder(5,5,5,5)));*/ imagePanel.setBackground(Color.WHITE); imagePanel.setSize(minWidth, minHeight); imagePanel.setLocation(0, 0); imagePanel.setOpaque(true); final JLayeredPane layeredPane = new JLayeredPane(); layeredPane.setPreferredSize(new Dimension(minWidth, minHeight)); layeredPane.add(mainPanel, JLayeredPane.DEFAULT_LAYER, 0); layeredPane.add(imagePanel, JLayeredPane.DEFAULT_LAYER, 0); layeredPane.addComponentListener(new ComponentListener() { @Override public void componentResized(ComponentEvent ce) { mainPanel.setBounds(0, 0, Math.max(minWidth, layeredPane.getWidth()), Math.max(minHeight, layeredPane.getHeight())); if (layeredPane.getWidth() > 1024) { tplotPanel.setPreferredSize(new Dimension(300, 100)); } else { tplotPanel.setPreferredSize(new Dimension(200, 100)); } imagePanel.setSize(mainPanel.getWidth(), mainPanel.getHeight()); imagePanel.setLocation(0, 0); mainPanel.repaint(); } @Override public void componentMoved(ComponentEvent ce) { //throw new UnsupportedOperationException("Not supported yet."); } @Override public void componentShown(ComponentEvent ce) { //throw new UnsupportedOperationException("Not supported yet."); } @Override public void componentHidden(ComponentEvent ce) { //throw new UnsupportedOperationException("Not supported yet."); } }); // on top, but invisible initially imagePanel.setVisible(false); JPanel bpanel = new JPanel(new BorderLayout()); final JButton button = new JButton( "<html><b>B<br>L<br>O<br>C<br>K<br> <br>D<br>I<br>A<br>G<br>R<br>A<br>M<br></b></html>"); button.setToolTipText("Click here to see the block diagram"); button.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { adjustSelectionPanel(); } }); bpanel.add(button, BorderLayout.CENTER); contentPane.add(layeredPane, BorderLayout.CENTER); contentPane.add(button, BorderLayout.EAST); JLabel mLabel = new JLabel(modeText, JLabel.CENTER); mLabel.setFont(new Font(modeText, Font.BOLD, 15)); contentPane.add(mLabel, BorderLayout.PAGE_START); return contentPane; }
From source file:greenfoot.gui.export.ExportPublishPane.java
/** * Creates the scenario information display including information such as title, description, url. * For an update (isUpdate = true), the displayed options are slightly different. *///w w w .j av a2s. co m private void createScenarioDisplay() { leftPanel = new Box(BoxLayout.Y_AXIS); JLabel text; MiksGridLayout titleAndDescLayout = new MiksGridLayout(6, 2, 8, 8); titleAndDescLayout.setVerticallyExpandingRow(3); titleAndDescPanel = new JPanel(titleAndDescLayout); titleAndDescPanel.setBackground(background); if (imagePanel == null) { imagePanel = new ImageEditPanel(IMAGE_WIDTH, IMAGE_HEIGHT); imagePanel.setBackground(background); } Box textPanel = new Box(BoxLayout.Y_AXIS); { text = new JLabel(Config.getString("export.publish.image1")); text.setAlignmentX(Component.RIGHT_ALIGNMENT); text.setFont(font); textPanel.add(text); text = new JLabel(Config.getString("export.publish.image2")); text.setAlignmentX(Component.RIGHT_ALIGNMENT); text.setFont(font); textPanel.add(text); } titleAndDescPanel.add(textPanel); titleAndDescPanel.add(imagePanel); if (isUpdate) { text = new JLabel(Config.getString("export.snapshot.label"), SwingConstants.TRAILING); text.setFont(font); titleAndDescPanel.add(text); keepScenarioScreenshot = new JCheckBox(); keepScenarioScreenshot.setSelected(true); // "keep screenshot" defaults to true, therefore the image panel should be disabled imagePanel.enableImageEditPanel(false); keepScenarioScreenshot.setName(Config.getString("export.publish.keepScenario")); keepScenarioScreenshot.setOpaque(false); keepScenarioScreenshot.addChangeListener(this); titleAndDescPanel.add(keepScenarioScreenshot); } text = new JLabel(Config.getString("export.publish.title"), SwingConstants.TRAILING); text.setFont(font); titleAndDescPanel.add(text); String title = project.getName(); if (getTitle() != null) { title = getTitle(); } titleField = new JTextField(title); titleField.setInputVerifier(new InputVerifier() { @Override public boolean verify(JComponent input) { String text = titleField.getText(); return text.length() > 0; } }); titleField.addFocusListener(new FocusAdapter() { @Override public void focusLost(FocusEvent e) { checkForExistingScenario(); } }); titleAndDescPanel.add(titleField); // If there is an update a "changes" description area is shown. // If not there a short description and long description area are shown. if (isUpdate) { JLabel updateLabel = new JLabel(Config.getString("export.publish.update"), SwingConstants.TRAILING); updateLabel.setVerticalAlignment(SwingConstants.TOP); updateLabel.setFont(font); updateArea = new JTextArea(); updateArea.setRows(6); updateArea.setLineWrap(true); updateArea.setWrapStyleWord(true); JScrollPane updatePane = new JScrollPane(updateArea); titleAndDescPanel.add(updateLabel); titleAndDescPanel.add(updatePane); titleAndDescLayout.setVerticallyExpandingRow(4); } else { text = new JLabel(Config.getString("export.publish.shortDescription"), SwingConstants.TRAILING); text.setFont(font); shortDescriptionField = new JTextField(); titleAndDescPanel.add(text); titleAndDescPanel.add(shortDescriptionField); text = new JLabel(Config.getString("export.publish.longDescription"), SwingConstants.TRAILING); text.setVerticalAlignment(SwingConstants.TOP); text.setFont(font); descriptionArea = new JTextArea(); descriptionArea.setRows(6); descriptionArea.setLineWrap(true); descriptionArea.setWrapStyleWord(true); JScrollPane description = new JScrollPane(descriptionArea); titleAndDescPanel.add(text); titleAndDescPanel.add(description); } text = new JLabel(Config.getString("export.publish.url"), SwingConstants.TRAILING); text.setFont(font); titleAndDescPanel.add(text); urlField = new JTextField(); titleAndDescPanel.add(urlField); leftPanel.add(titleAndDescPanel, BorderLayout.SOUTH); JComponent sourceAndLockPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 8, 0)); { sourceAndLockPanel.setBackground(background); includeSource = new JCheckBox(Config.getString("export.publish.includeSource")); includeSource.setOpaque(false); includeSource.setSelected(false); includeSource.setFont(font); sourceAndLockPanel.add(includeSource); lockScenario.setFont(font); sourceAndLockPanel.add(lockScenario); sourceAndLockPanel.setMaximumSize(sourceAndLockPanel.getPreferredSize()); } leftPanel.add(sourceAndLockPanel, BorderLayout.SOUTH); }
From source file:com.juanhg.icecubes.IceCubesApplet.java
private void autogeneratedCode() { JPanel panel_control = new JPanel(); panel_control.setBorder(new CompoundBorder(new EtchedBorder(EtchedBorder.RAISED, null, null), new BevelBorder(BevelBorder.RAISED, null, null, null, null))); JPanel panelInputs = new JPanel(); panelInputs.setToolTipText(""); panelInputs.setBorder(new MatteBorder(1, 1, 1, 1, (Color) new Color(0, 0, 0))); JPanel panelOutputs = new JPanel(); panelOutputs.setToolTipText(""); panelOutputs.setBorder(new MatteBorder(1, 1, 1, 1, (Color) new Color(0, 0, 0))); JPanel panelTitleOutputs = new JPanel(); panelTitleOutputs.setBorder(new BevelBorder(BevelBorder.RAISED, null, null, null, null)); JLabel labelOutputData = new JLabel("Datos de la Simulaci\u00F3n"); labelOutputData.setFont(new Font("Tahoma", Font.PLAIN, 14)); panelTitleOutputs.add(labelOutputData); lblO1 = new JLabel("T:"); lblO1.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblO1Value = new JLabel(); lblO1Value.setText("0"); lblO1Value.setFont(new Font("Tahoma", Font.PLAIN, 14)); JLabel lblO2 = new JLabel("t:"); lblO2.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblO2Value = new JLabel(); lblO2Value.setText("0"); lblO2Value.setFont(new Font("Tahoma", Font.PLAIN, 14)); JLabel lblV = new JLabel("V:"); lblV.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblVValue = new JLabel(); lblVValue.setText("0"); lblVValue.setFont(new Font("Tahoma", Font.PLAIN, 14)); GroupLayout gl_panelOutputs = new GroupLayout(panelOutputs); gl_panelOutputs.setHorizontalGroup(gl_panelOutputs.createParallelGroup(Alignment.LEADING) .addComponent(panelTitleOutputs, GroupLayout.DEFAULT_SIZE, 344, Short.MAX_VALUE) .addGroup(gl_panelOutputs.createSequentialGroup() .addGroup(gl_panelOutputs.createParallelGroup(Alignment.TRAILING) .addGroup(gl_panelOutputs.createSequentialGroup().addGap(22) .addComponent(lblO1, GroupLayout.DEFAULT_SIZE, 88, Short.MAX_VALUE) .addPreferredGap(ComponentPlacement.RELATED)) .addGroup(gl_panelOutputs.createSequentialGroup().addContainerGap() .addComponent(lblO2, GroupLayout.PREFERRED_SIZE, 57, GroupLayout.PREFERRED_SIZE) .addGap(37))) .addGroup(// w w w. j a v a 2s.co m gl_panelOutputs.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelOutputs.createSequentialGroup() .addComponent(lblO1Value, GroupLayout.DEFAULT_SIZE, 52, Short.MAX_VALUE) .addGap(3)) .addGroup(gl_panelOutputs.createSequentialGroup() .addComponent(lblO2Value, GroupLayout.PREFERRED_SIZE, 55, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED))) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(lblV, GroupLayout.PREFERRED_SIZE, 44, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(lblVValue, GroupLayout.PREFERRED_SIZE, 110, GroupLayout.PREFERRED_SIZE) .addContainerGap())); gl_panelOutputs .setVerticalGroup(gl_panelOutputs.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelOutputs.createSequentialGroup() .addComponent(panelTitleOutputs, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.UNRELATED) .addGroup(gl_panelOutputs.createParallelGroup(Alignment.BASELINE) .addComponent(lblO1).addComponent(lblO1Value) .addComponent(lblV, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE) .addComponent(lblVValue, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.UNRELATED) .addGroup(gl_panelOutputs.createParallelGroup(Alignment.BASELINE) .addComponent(lblO2, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE) .addComponent(lblO2Value, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE)) .addGap(40))); panelOutputs.setLayout(gl_panelOutputs); JPanel panelLicense = new JPanel(); panelLicense.setBorder(new LineBorder(new Color(0, 0, 0))); JPanel panel_6 = new JPanel(); panel_6.setBorder(new LineBorder(new Color(0, 0, 0))); GroupLayout gl_panel_control = new GroupLayout(panel_control); gl_panel_control .setHorizontalGroup(gl_panel_control.createParallelGroup(Alignment.TRAILING) .addGroup(Alignment.LEADING, gl_panel_control.createSequentialGroup().addContainerGap() .addGroup(gl_panel_control.createParallelGroup(Alignment.LEADING) .addComponent(panelOutputs, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(panelInputs, GroupLayout.PREFERRED_SIZE, 346, Short.MAX_VALUE) .addComponent(panel_6, Alignment.TRAILING, GroupLayout.PREFERRED_SIZE, 346, Short.MAX_VALUE) .addComponent(panelLicense, GroupLayout.DEFAULT_SIZE, 346, Short.MAX_VALUE)) .addContainerGap())); gl_panel_control.setVerticalGroup(gl_panel_control.createParallelGroup(Alignment.LEADING) .addGroup(gl_panel_control.createSequentialGroup().addContainerGap() .addComponent(panelInputs, GroupLayout.PREFERRED_SIZE, 225, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(panelOutputs, GroupLayout.PREFERRED_SIZE, 112, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.UNRELATED) .addComponent(panel_6, GroupLayout.PREFERRED_SIZE, 80, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(panelLicense, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); btnLaunchSimulation = new JButton("Iniciar"); btnLaunchSimulation.setFont(new Font("Tahoma", Font.PLAIN, 16)); btnLaunchSimulation.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { btnLaunchSimulationEvent(event); } }); GroupLayout gl_panel_6 = new GroupLayout(panel_6); gl_panel_6.setHorizontalGroup(gl_panel_6.createParallelGroup(Alignment.LEADING) .addGroup(gl_panel_6.createSequentialGroup().addContainerGap() .addComponent(btnLaunchSimulation, GroupLayout.DEFAULT_SIZE, 324, Short.MAX_VALUE) .addContainerGap())); gl_panel_6.setVerticalGroup(gl_panel_6.createParallelGroup(Alignment.LEADING) .addGroup(gl_panel_6 .createSequentialGroup().addContainerGap().addComponent(btnLaunchSimulation, GroupLayout.PREFERRED_SIZE, 55, GroupLayout.PREFERRED_SIZE) .addContainerGap(78, Short.MAX_VALUE))); panel_6.setLayout(gl_panel_6); JLabel lblNewLabel = new JLabel("GNU GENERAL PUBLIC LICENSE"); panelLicense.add(lblNewLabel); JLabel LabelI1 = new JLabel("Volumen"); LabelI1.setFont(new Font("Tahoma", Font.PLAIN, 14)); JLabel labelI2 = new JLabel("T"); labelI2.setFont(new Font("Tahoma", Font.PLAIN, 14)); JLabel labelI3 = new JLabel("t"); labelI3.setFont(new Font("Tahoma", Font.PLAIN, 14)); JPanel panelTitle = new JPanel(); panelTitle.setBorder(new BevelBorder(BevelBorder.RAISED, null, null, null, null)); lblTValue = new JLabel("15"); lblTValue.setFont(new Font("Tahoma", Font.PLAIN, 14)); lbltValue = new JLabel("-15"); lbltValue.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblVolValue = new JLabel("20"); lblVolValue.setFont(new Font("Tahoma", Font.PLAIN, 14)); sliderVol = new JSlider(); sliderVol.setMinimum(1); sliderVol.setMaximum(30); sliderVol.setMinorTickSpacing(1); sliderVol.setValue(20); sliderVol.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent event) { sliderI1Event(); } }); sliderT = new JSlider(); sliderT.setMinimum(5); sliderT.setMaximum(30); sliderT.setMinorTickSpacing(1); sliderT.setValue(15); sliderT.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { sliderI2Event(); } }); slidert = new JSlider(); slidert.setMinimum(5); slidert.setMaximum(30); slidert.setValue(15); slidert.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { sliderI3Event(); } }); JLabel lblI4 = new JLabel("N\u00BA de Cubitos"); lblI4.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblNValue = new JLabel("1"); lblNValue.setFont(new Font("Tahoma", Font.PLAIN, 14)); sliderN = new JSlider(); sliderN.setMinimum(1); sliderN.setMaximum(4); sliderN.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent arg0) { sliderI4Event(); } }); sliderN.setValue(1); sliderN.setMinorTickSpacing(1); waterImage = loadImage(water); btnWater = new JButton(new ImageIcon(waterImage)); btnWater.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { btnWater.setEnabled(false); btnMilk.setEnabled(true); btnOrange.setEnabled(true); btnlemonade.setEnabled(true); type = WATER; fluidColor = new Color(100, 180, 255, 70); updateGlass(IceCubesModel.getV(sliderVol.getValue(), sliderN.getValue())); repaint(); } }); milkImage = loadImage(milk); btnMilk = new JButton(new ImageIcon(milkImage)); btnMilk.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { btnWater.setEnabled(true); btnMilk.setEnabled(false); btnOrange.setEnabled(true); btnlemonade.setEnabled(true); type = MILK; fluidColor = new Color(255, 255, 255, 255); updateGlass(IceCubesModel.getV(sliderVol.getValue(), sliderN.getValue())); repaint(); } }); orangeImage = loadImage(orange); btnOrange = new JButton(new ImageIcon(orangeImage)); btnOrange.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { btnWater.setEnabled(true); btnMilk.setEnabled(true); btnOrange.setEnabled(false); btnlemonade.setEnabled(true); type = ORANGE; fluidColor = new Color(225, 150, 0, 220); updateGlass(IceCubesModel.getV(sliderVol.getValue(), sliderN.getValue())); repaint(); } }); lemonadeImage = loadImage(lemonade); btnlemonade = new JButton(new ImageIcon(lemonadeImage)); btnlemonade.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { btnWater.setEnabled(true); btnMilk.setEnabled(true); btnOrange.setEnabled(true); btnlemonade.setEnabled(false); type = LEMONADE; fluidColor = new Color(225, 225, 0, 150); updateGlass(IceCubesModel.getV(sliderVol.getValue(), sliderN.getValue())); repaint(); } }); GroupLayout gl_panelInputs = new GroupLayout(panelInputs); gl_panelInputs.setHorizontalGroup(gl_panelInputs.createParallelGroup(Alignment.TRAILING) .addComponent(panelTitle, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 344, Short.MAX_VALUE) .addGroup(gl_panelInputs.createSequentialGroup().addContainerGap(23, Short.MAX_VALUE) .addGroup(gl_panelInputs.createParallelGroup(Alignment.TRAILING).addGroup(gl_panelInputs .createSequentialGroup() .addComponent(btnWater, GroupLayout.PREFERRED_SIZE, 70, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(btnMilk, GroupLayout.PREFERRED_SIZE, 70, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(btnOrange, GroupLayout.PREFERRED_SIZE, 70, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(btnlemonade, GroupLayout.PREFERRED_SIZE, 70, GroupLayout.PREFERRED_SIZE) .addGap(8)) .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelInputs.createSequentialGroup().addGroup(gl_panelInputs .createParallelGroup(Alignment.TRAILING, false) .addComponent(labelI3, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(LabelI1, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(labelI2, Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 120, GroupLayout.PREFERRED_SIZE)) .addGap(18) .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING) .addComponent(lblVolValue, GroupLayout.PREFERRED_SIZE, 42, GroupLayout.PREFERRED_SIZE) .addComponent(lblTValue, GroupLayout.PREFERRED_SIZE, 56, GroupLayout.PREFERRED_SIZE) .addComponent(lbltValue, GroupLayout.PREFERRED_SIZE, 56, GroupLayout.PREFERRED_SIZE)) .addGap(18).addGroup( gl_panelInputs.createParallelGroup(Alignment.LEADING, false) .addComponent(sliderVol, 0, 0, Short.MAX_VALUE) .addComponent(sliderT, 0, 0, Short.MAX_VALUE) .addComponent(slidert, GroupLayout.PREFERRED_SIZE, 88, GroupLayout.PREFERRED_SIZE))) .addGroup(gl_panelInputs.createSequentialGroup() .addComponent(lblI4, GroupLayout.PREFERRED_SIZE, 120, GroupLayout.PREFERRED_SIZE) .addGap(18) .addComponent(lblNValue, GroupLayout.PREFERRED_SIZE, 56, GroupLayout.PREFERRED_SIZE) .addGap(18).addComponent(sliderN, GroupLayout.PREFERRED_SIZE, 88, GroupLayout.PREFERRED_SIZE)))) .addGap(15))); gl_panelInputs.setVerticalGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelInputs.createSequentialGroup() .addComponent(panelTitle, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addGap(18) .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelInputs.createParallelGroup(Alignment.BASELINE) .addComponent(LabelI1).addComponent(lblVolValue, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE)) .addComponent(sliderVol, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelInputs.createParallelGroup(Alignment.BASELINE) .addComponent(labelI2).addComponent(lblTValue, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE)) .addComponent(sliderT, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addGap(11) .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING).addComponent(labelI3) .addComponent(lbltValue, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE) .addComponent(slidert, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.UNRELATED) .addGroup(gl_panelInputs.createParallelGroup(Alignment.LEADING) .addComponent(lblI4, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE) .addComponent(lblNValue, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE) .addComponent(sliderN, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addGap(7) .addGroup(gl_panelInputs.createParallelGroup(Alignment.TRAILING, false) .addComponent(btnWater, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(btnMilk, GroupLayout.DEFAULT_SIZE, 57, Short.MAX_VALUE) .addComponent(btnOrange, GroupLayout.DEFAULT_SIZE, 57, Short.MAX_VALUE) .addComponent(btnlemonade, GroupLayout.DEFAULT_SIZE, 57, Short.MAX_VALUE)) .addGap(11))); JLabel lblDatosDeEntrada = new JLabel("Datos de Entrada"); lblDatosDeEntrada.setFont(new Font("Tahoma", Font.PLAIN, 14)); panelTitle.add(lblDatosDeEntrada); panelInputs.setLayout(gl_panelInputs); panel_control.setLayout(gl_panel_control); JPanel panel_visualizar = new JPanel(); panel_visualizar.setBackground(Color.WHITE); GroupLayout groupLayout = new GroupLayout(getContentPane()); groupLayout.setHorizontalGroup(groupLayout.createParallelGroup(Alignment.LEADING).addGroup( Alignment.TRAILING, groupLayout.createSequentialGroup().addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(panel_control, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(panel_visualizar, GroupLayout.PREFERRED_SIZE, 694, GroupLayout.PREFERRED_SIZE) .addGap(156))); groupLayout.setVerticalGroup(groupLayout.createParallelGroup(Alignment.TRAILING).addGroup(Alignment.LEADING, groupLayout.createSequentialGroup().addGap(12) .addGroup(groupLayout.createParallelGroup(Alignment.TRAILING, false) .addComponent(panel_visualizar, Alignment.LEADING, 0, 0, Short.MAX_VALUE) .addComponent(panel_control, Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 494, Short.MAX_VALUE)) .addContainerGap(84, Short.MAX_VALUE))); JPanel panel = new JPanel(); panel.setBorder(new LineBorder(new Color(0, 0, 0))); panel.setBounds(0, 0, 368, 494); panel.setBackground(Color.WHITE); JPanel panel_1 = new JPanel(); panel_1.setBounds(1, 1, 366, 31); panel_1.setBorder(new BevelBorder(BevelBorder.RAISED, null, null, null, null)); JLabel lblSimulacin = new JLabel("Simulaci\u00F3n"); lblSimulacin.setFont(new Font("Tahoma", Font.PLAIN, 14)); panel_1.add(lblSimulacin); JPanel panel_3 = new JPanel(); panel_3.setBorder(new LineBorder(new Color(0, 0, 0))); panel_3.setBackground(Color.WHITE); panel_3.setBounds(368, 0, 326, 494); panel_visualizar.setLayout(null); panel_visualizar.add(panel); panel.setLayout(null); panel.add(panel_1); panel_7 = new JPanelGrafica(); panel_7.setBackground(Color.WHITE); panel_7.setBounds(1, 31, 366, 463); panel.add(panel_7); panelGlass = new JPanelGrafica(); panelGlass.setBackground(Color.WHITE); GroupLayout gl_panel_7 = new GroupLayout(panel_7); gl_panel_7.setHorizontalGroup(gl_panel_7.createParallelGroup(Alignment.LEADING).addComponent(panelGlass, GroupLayout.DEFAULT_SIZE, 366, Short.MAX_VALUE)); gl_panel_7.setVerticalGroup(gl_panel_7.createParallelGroup(Alignment.LEADING).addComponent(panelGlass, GroupLayout.DEFAULT_SIZE, 463, Short.MAX_VALUE)); panel_7.setLayout(gl_panel_7); panel_visualizar.add(panel_3); panel_3.setLayout(null); JPanel panel_4 = new JPanel(); panel_4.setBounds(1, 1, 324, 31); panel_4.setBorder(new BevelBorder(BevelBorder.RAISED, null, null, null, null)); JLabel lblGrficaDeEvolucin = new JLabel("Gr\u00E1fica de Evoluci\u00F3n (T frente a Q)"); lblGrficaDeEvolucin.setFont(new Font("Tahoma", Font.PLAIN, 14)); panel_4.add(lblGrficaDeEvolucin); panel_3.add(panel_4); JPanel panel7 = new JPanel(); panel7.setBorder(new LineBorder(new Color(0, 0, 0))); panel7.setBackground(Color.WHITE); panel7.setBounds(1, 31, 324, 463); panel_3.add(panel7); panel7.setLayout(null); panelChart = new JPanelGrafica(); panelChart.setBorder(new LineBorder(new Color(0, 0, 0))); panelChart.setBackground(Color.WHITE); panelChart.setBounds(0, 0, 324, 462); panel7.add(panelChart); getContentPane().setLayout(groupLayout); }
From source file:direccion.Reportes.java
public Reportes() { String titulo = "Reportes"; jFrame = new JFrame(titulo); jFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); jFrame.setSize(800, 600);// w ww . j a va 2 s . c o m Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); int x = (screenSize.width / 2) - (jFrame.getSize().width / 2); int y = (screenSize.height / 2) - (jFrame.getSize().height / 2); jFrame.setLocation(x, y); JLabel etiqueta = new JLabel("Reportes"); etiqueta.setBounds(300, 25, 200, 50); etiqueta.setFont(new Font("Verdana", Font.BOLD, 30)); etiqueta.setForeground(Color.BLACK); JMenuBar jMenuBar = new JMenuBar(); JMenu acceso = new JMenu("Acceso a"); JMenu ayuda = new JMenu("Ayuda"); JMenuItem rec_hum = new JMenuItem("Recursos Humanos"); JMenuItem conta = new JMenuItem("Contabilidad"); JMenuItem ventas = new JMenuItem("Ventas"); JMenuItem compras = new JMenuItem("Compras"); JMenuItem inventario = new JMenuItem("Inventario"); JMenuItem acerca_de = new JMenuItem("Acerca de"); acerca_de.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { JOptionPane.showMessageDialog(null, "Ayuda", "Ayuda", 3); } }); acceso.add(rec_hum); acceso.add(conta); acceso.add(ventas); acceso.add(compras); acceso.add(inventario); ayuda.add(acerca_de); jMenuBar.add(acceso); jMenuBar.add(ayuda); JCalendar cal1 = new JCalendar(); cal1.setBounds(250, 150, 400, 300); JCalendarCombo cal2 = new JCalendarCombo(); cal2.setBounds(250, 150, 400, 300); String reportes[] = { "Mantenimiento", "Compras", "Ventas", "Inventario", "Contabilidad", "Recursos Humanos" }; JComboBox combobox = new JComboBox(reportes); combobox.setBounds(300, 100, 150, 30); JLabel calendario = new JLabel("Fecha de Operacin:"); calendario.setBounds(60, 150, 150, 30); JButton aceptar = new JButton("Aceptar"); aceptar.setBounds(50, 200, 150, 30); aceptar.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (combobox.getSelectedIndex() == 0) { datos_mantenimiento.setValue("Recursos Humanos", d_mant_rh); datos_mantenimiento.setValue("Contabilidad", d_mant_cont); datos_mantenimiento.setValue("Ventas", d_mant_vent); datos_mantenimiento.setValue("Compras", d_mant_comp); datos_mantenimiento.setValue("Inventario", d_mant_inv); datos_mantenimiento.setValue("Mantenimiento", d_mant_mant); Grafica = ChartFactory.createPieChart3D("Mantenimiento", datos_mantenimiento, true, true, true); ChartPanel panel_grafica = new ChartPanel(Grafica); JFrame frame_grafica = new JFrame("Grfico"); JMenuBar menu = new JMenuBar(); JMenu archivo = new JMenu("Archivo"); JMenuItem guardar = new JMenuItem("Guardar como reporte..."); guardar.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Document document = new Document(); PdfWriter writer = null; try { writer = PdfWriter.getInstance(document, new FileOutputStream("Grfico Mantenimiento.pdf")); } catch (DocumentException ex) { Logger.getLogger(JFrame.class.getName()).log(Level.SEVERE, null, ex); } catch (FileNotFoundException ex) { Logger.getLogger(JFrame.class.getName()).log(Level.SEVERE, null, ex); } document.open(); PdfContentByte cb = writer.getDirectContent(); PdfTemplate tp = cb.createTemplate(450, 450); Graphics2D g2 = tp.createGraphicsShapes(450, 450); menu.setVisible(false); frame_grafica.print(g2); menu.setVisible(true); g2.dispose(); cb.addTemplate(tp, 30, 400); document.close(); HSSFWorkbook workbook = new HSSFWorkbook(); HSSFSheet sheet = workbook.createSheet("Reporte de Mantenimiento"); Row fila = sheet.createRow(0); File archivo = new File("Reporte de Mantenimiento.xls"); Cell celda; String[] titulos = { "Recursos Humanos", "Contabilidad", "Ventas", "Compras", "Inventario", "Mantenimiento" }; Double[] datos = { d_mant_rh, d_mant_cont, d_mant_vent, d_mant_comp, d_mant_inv, d_mant_mant }; int i; for (i = 0; i < titulos.length; i++) { celda = fila.createCell(i); celda.setCellValue(titulos[i]); } fila = sheet.createRow(1); for (i = 0; i < datos.length; i++) { celda = fila.createCell(i); celda.setCellValue(datos[i]); } try { FileOutputStream out = new FileOutputStream(archivo); workbook.write(out); out.close(); System.out.println("Archivo creado exitosamente!"); } catch (IOException ex) { System.out.println("Error de escritura"); ex.printStackTrace(); } } }); archivo.add(guardar); menu.add(archivo); frame_grafica.getContentPane().add(panel_grafica); frame_grafica.setBounds(60, 60, 450, 400); frame_grafica.setJMenuBar(menu); frame_grafica.setVisible(true); frame_grafica.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); } if (combobox.getSelectedIndex() == 1) { datos_compras.setValue("Nomina", d_comp_nom); datos_compras.setValue("Compras", d_comp_comp); datos_compras.setValue("Gastos Fijos", d_comp_gf); datos_compras.setValue("Gastos Variables", d_comp_gv); datos_compras.setValue("Gastos Otros", d_comp_go); Grafica = ChartFactory.createPieChart3D("Compras", datos_compras, true, true, true); ChartPanel panel_grafica = new ChartPanel(Grafica); JFrame frame_grafica = new JFrame("Grfico"); JMenuBar menu = new JMenuBar(); JMenu archivo = new JMenu("Archivo"); JMenuItem guardar = new JMenuItem("Guardar como reporte..."); guardar.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Document document = new Document(); PdfWriter writer = null; try { writer = PdfWriter.getInstance(document, new FileOutputStream("Grfico Compras.pdf")); } catch (DocumentException ex) { Logger.getLogger(JFrame.class.getName()).log(Level.SEVERE, null, ex); } catch (FileNotFoundException ex) { Logger.getLogger(JFrame.class.getName()).log(Level.SEVERE, null, ex); } document.open(); menu.setVisible(false); PdfContentByte cb = writer.getDirectContent(); PdfTemplate tp = cb.createTemplate(450, 450); Graphics2D g2 = tp.createGraphicsShapes(850, 850); menu.setVisible(false); frame_grafica.print(g2); menu.setVisible(true); g2.dispose(); cb.addTemplate(tp, 30, 400); document.close(); HSSFWorkbook workbook = new HSSFWorkbook(); HSSFSheet sheet = workbook.createSheet("Reporte de Compras"); Row fila = sheet.createRow(0); File archivo = new File("Reporte de Compras.xls"); Cell celda; String[] titulos = { "Nomina", "Compras", "Gastos Fijos", "Gastos Variables", "Gastos Otros" }; Double[] datos = { d_comp_nom, d_comp_comp, d_comp_gf, d_comp_gv, d_comp_go }; int i; for (i = 0; i < titulos.length; i++) { celda = fila.createCell(i); celda.setCellValue(titulos[i]); } fila = sheet.createRow(1); for (i = 0; i < datos.length; i++) { celda = fila.createCell(i); celda.setCellValue(datos[i]); } try { FileOutputStream out = new FileOutputStream(archivo); workbook.write(out); out.close(); System.out.println("Archivo creado exitosamente!"); } catch (IOException ex) { System.out.println("Error de escritura"); ex.printStackTrace(); } } }); archivo.add(guardar); menu.add(archivo); frame_grafica.getContentPane().add(panel_grafica); frame_grafica.setBounds(60, 60, 450, 400); frame_grafica.setJMenuBar(menu); frame_grafica.setVisible(true); frame_grafica.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); } if (combobox.getSelectedIndex() == 2) { datos_ventas.addValue(d_vent_s1_lu, "Semana 1", "Lunes"); datos_ventas.addValue(d_vent_s1_ma, "Semana 1", "Martes"); datos_ventas.addValue(d_vent_s1_mi, "Semana 1", "Mircoles"); datos_ventas.addValue(d_vent_s1_ju, "Semana 1", "Jueves"); datos_ventas.addValue(d_vent_s1_vi, "Semana 1", "Viernes"); datos_ventas.addValue(d_vent_s1_sa, "Semana 1", "Sbado"); datos_ventas.addValue(d_vent_s1_do, "Semana 1", "Domingo"); datos_ventas.addValue(d_vent_s2_lu, "Semana 2", "Lunes"); datos_ventas.addValue(d_vent_s2_ma, "Semana 2", "Martes"); datos_ventas.addValue(d_vent_s2_mi, "Semana 2", "Mircoles"); datos_ventas.addValue(d_vent_s2_ju, "Semana 2", "Jueves"); datos_ventas.addValue(d_vent_s2_vi, "Semana 2", "Viernes"); datos_ventas.addValue(d_vent_s2_sa, "Semana 2", "Sbado"); datos_ventas.addValue(d_vent_s2_do, "Semana 2", "Domingo"); Grafica = ChartFactory.createLineChart3D("Ventas", "Das", "Ingresos", datos_ventas, PlotOrientation.VERTICAL, true, true, false); ChartPanel panel_grafica = new ChartPanel(Grafica); JFrame frame_grafica = new JFrame("Grfico"); JMenuBar menu = new JMenuBar(); JMenu archivo = new JMenu("Archivo"); JMenuItem guardar = new JMenuItem("Guardar como reporte..."); guardar.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Document document = new Document(); PdfWriter writer = null; try { writer = PdfWriter.getInstance(document, new FileOutputStream("Grfico Ventas.pdf")); } catch (DocumentException ex) { Logger.getLogger(JFrame.class.getName()).log(Level.SEVERE, null, ex); } catch (FileNotFoundException ex) { Logger.getLogger(JFrame.class.getName()).log(Level.SEVERE, null, ex); } document.open(); PdfContentByte cb = writer.getDirectContent(); PdfTemplate tp = cb.createTemplate(450, 450); Graphics2D g2 = tp.createGraphicsShapes(450, 450); menu.setVisible(false); frame_grafica.print(g2); menu.setVisible(true); g2.dispose(); cb.addTemplate(tp, 30, 400); document.close(); HSSFWorkbook workbook = new HSSFWorkbook(); HSSFSheet sheet = workbook.createSheet("Reporte de Ventas"); Row fila = sheet.createRow(0); File archivo = new File("Reporte de Ventas.xls"); Cell celda; String[] titulos1 = { "S1 lunes", "S1 martes", "S1 miercoles", "S1 jueves", "S1 viernes", "S1 sabado", "S1 domingo" }; String[] titulos2 = { "S2 lunes", "S2 martes", "S2 miercoles", "S2 jueves", "S2 viernes", "S2 sabado", "S2 domingo" }; Double[] datos1 = { d_vent_s1_lu, d_vent_s1_ma, d_vent_s1_mi, d_vent_s1_ju, d_vent_s1_vi, d_vent_s1_sa, d_vent_s1_do }; Double[] datos2 = { d_vent_s2_lu, d_vent_s2_ma, d_vent_s2_mi, d_vent_s2_ju, d_vent_s2_vi, d_vent_s2_sa, d_vent_s2_do }; int i, j; for (i = 0; i < titulos1.length; i++) { celda = fila.createCell(i); celda.setCellValue(titulos1[i]); } fila = sheet.createRow(1); for (i = 0; i < datos1.length; i++) { celda = fila.createCell(i); celda.setCellValue(datos1[i]); } fila = sheet.createRow(3); for (j = 0; j < titulos2.length; j++) { celda = fila.createCell(j); celda.setCellValue(titulos2[j]); } fila = sheet.createRow(4); for (j = 0; j < datos2.length; j++) { celda = fila.createCell(j); celda.setCellValue(datos2[j]); } try { FileOutputStream out = new FileOutputStream(archivo); workbook.write(out); out.close(); System.out.println("Archivo creado exitosamente!"); } catch (IOException ex) { System.out.println("Error de escritura"); ex.printStackTrace(); } } }); archivo.add(guardar); menu.add(archivo); frame_grafica.getContentPane().add(panel_grafica); frame_grafica.setBounds(60, 60, 450, 400); frame_grafica.setJMenuBar(menu); frame_grafica.setVisible(true); frame_grafica.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); } if (combobox.getSelectedIndex() == 3) { datos_inventario.setValue("Producto 1", d_inv_p1); datos_inventario.setValue("Producto 2", d_inv_p2); datos_inventario.setValue("Producto 3", d_inv_p3); datos_inventario.setValue("Producto 4", d_inv_p4); datos_inventario.setValue("Producto 5", d_inv_p5); Grafica = ChartFactory.createPieChart3D("Inventario", datos_inventario, true, true, true); ChartPanel panel_grafica = new ChartPanel(Grafica); JFrame frame_grafica = new JFrame("Grfico"); JMenuBar menu = new JMenuBar(); JMenu archivo = new JMenu("Archivo"); JMenuItem guardar = new JMenuItem("Guardar como reporte..."); guardar.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Document document = new Document(); PdfWriter writer = null; try { writer = PdfWriter.getInstance(document, new FileOutputStream("Grfico Inventario.pdf")); } catch (DocumentException ex) { Logger.getLogger(JFrame.class.getName()).log(Level.SEVERE, null, ex); } catch (FileNotFoundException ex) { Logger.getLogger(JFrame.class.getName()).log(Level.SEVERE, null, ex); } document.open(); PdfContentByte cb = writer.getDirectContent(); PdfTemplate tp = cb.createTemplate(450, 450); Graphics2D g2 = tp.createGraphicsShapes(450, 450); menu.setVisible(false); frame_grafica.print(g2); menu.setVisible(true); g2.dispose(); cb.addTemplate(tp, 30, 400); document.close(); HSSFWorkbook workbook = new HSSFWorkbook(); HSSFSheet sheet = workbook.createSheet("Reporte de Inventario"); Row fila = sheet.createRow(0); File archivo = new File("Reporte de Inventario.xls"); Cell celda; String[] titulos = { "Producto 1", "Producto 2", "Prroducto 3", "Producto 4", "Producto 5" }; Double[] datos = { d_inv_p1, d_inv_p2, d_inv_p3, d_inv_p4, d_inv_p5 }; int i; for (i = 0; i < titulos.length; i++) { celda = fila.createCell(i); celda.setCellValue(titulos[i]); } fila = sheet.createRow(1); for (i = 0; i < datos.length; i++) { celda = fila.createCell(i); celda.setCellValue(datos[i]); } try { FileOutputStream out = new FileOutputStream(archivo); workbook.write(out); out.close(); System.out.println("Archivo creado exitosamente!"); } catch (IOException ex) { System.out.println("Error de escritura"); ex.printStackTrace(); } } }); archivo.add(guardar); menu.add(archivo); frame_grafica.getContentPane().add(panel_grafica); frame_grafica.setBounds(60, 60, 450, 400); frame_grafica.setJMenuBar(menu); frame_grafica.setVisible(true); frame_grafica.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); } if (combobox.getSelectedIndex() == 4) { datos_contabilidad.addValue(d_cont_e_lu, "Entradas", "Lunes"); datos_contabilidad.addValue(d_cont_e_ma, "Entradas", "Martes"); datos_contabilidad.addValue(d_cont_e_mi, "Entradas", "Mircoles"); datos_contabilidad.addValue(d_cont_e_ju, "Entradas", "Jueves"); datos_contabilidad.addValue(d_cont_e_vi, "Entradas", "Viernes"); datos_contabilidad.addValue(d_cont_e_sa, "Entradas", "Sbado"); datos_contabilidad.addValue(d_cont_e_do, "Entradas", "Domingo"); datos_contabilidad.addValue(d_cont_s_lu, "Salidas", "Lunes"); datos_contabilidad.addValue(d_cont_s_ma, "Salidas", "Martes"); datos_contabilidad.addValue(d_cont_s_mi, "Salidas", "Mircoles"); datos_contabilidad.addValue(d_cont_s_ju, "Salidas", "Jueves"); datos_contabilidad.addValue(d_cont_s_vi, "Salidas", "Viernes"); datos_contabilidad.addValue(d_cont_s_sa, "Salidas", "Sbado"); datos_contabilidad.addValue(d_cont_s_do, "Salidas", "Domingo"); datos_contabilidad.addValue(d_cont_u_lu, "Utilidades", "Lunes"); datos_contabilidad.addValue(d_cont_u_ma, "Utilidades", "Martes"); datos_contabilidad.addValue(d_cont_u_mi, "Utilidades", "Mircoles"); datos_contabilidad.addValue(d_cont_u_ju, "Utilidades", "Jueves"); datos_contabilidad.addValue(d_cont_u_vi, "Utilidades", "Viernes"); datos_contabilidad.addValue(d_cont_u_sa, "Utilidades", "Sbado"); datos_contabilidad.addValue(d_cont_u_do, "Utilidades", "Domingo"); Grafica = ChartFactory.createLineChart3D("Contabilidad", "Das", "Ingresos", datos_contabilidad, PlotOrientation.VERTICAL, true, true, false); ChartPanel panel_grafica = new ChartPanel(Grafica); JFrame frame_grafica = new JFrame("Grfico"); JMenuBar menu = new JMenuBar(); JMenu archivo = new JMenu("Archivo"); JMenuItem guardar = new JMenuItem("Guardar como reporte..."); guardar.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Document document = new Document(); PdfWriter writer = null; try { writer = PdfWriter.getInstance(document, new FileOutputStream("Grfico Contabilidad.pdf")); } catch (DocumentException ex) { Logger.getLogger(JFrame.class.getName()).log(Level.SEVERE, null, ex); } catch (FileNotFoundException ex) { Logger.getLogger(JFrame.class.getName()).log(Level.SEVERE, null, ex); } document.open(); PdfContentByte cb = writer.getDirectContent(); PdfTemplate tp = cb.createTemplate(450, 450); Graphics2D g2 = tp.createGraphicsShapes(450, 450); menu.setVisible(false); frame_grafica.print(g2); menu.setVisible(true); g2.dispose(); cb.addTemplate(tp, 30, 400); document.close(); HSSFWorkbook workbook = new HSSFWorkbook(); HSSFSheet sheet = workbook.createSheet("Reporte de Contabilidad"); Row fila = sheet.createRow(0); File archivo = new File("Reporte de Contabilidad.xls"); Cell celda; String[] t_ent = { "E lunes", "E martes", "E miercoles", "E jueves", "E viernes", "E sabado", "E domingo" }; String[] t_sal = { "S lunes", "S martes", "S miercoles", "S jueves", "S viernes", "S sabado", "S domingo" }; String[] t_uti = { "U lunes", "U martes", "U miercoles", "U jueves", "U viernes", "U sabado", "U domingo" }; Double[] d_ent = { d_cont_e_lu, d_cont_e_ma, d_cont_e_mi, d_cont_e_ju, d_cont_e_vi, d_cont_e_sa, d_cont_e_do }; Double[] d_sal = { d_cont_s_lu, d_cont_s_ma, d_cont_s_mi, d_cont_s_ju, d_cont_s_vi, d_cont_s_sa, d_cont_s_do }; Double[] d_uti = { d_cont_u_lu, d_cont_u_ma, d_cont_u_mi, d_cont_u_ju, d_cont_u_vi, d_cont_u_sa, d_cont_u_do }; int i, j, k; for (i = 0; i < t_ent.length; i++) { celda = fila.createCell(i); celda.setCellValue(t_ent[i]); } fila = sheet.createRow(1); for (i = 0; i < d_ent.length; i++) { celda = fila.createCell(i); celda.setCellValue(d_ent[i]); } fila = sheet.createRow(3); for (j = 0; j < t_sal.length; j++) { celda = fila.createCell(j); celda.setCellValue(t_sal[j]); } fila = sheet.createRow(4); for (j = 0; j < d_sal.length; j++) { celda = fila.createCell(j); celda.setCellValue(d_sal[j]); } fila = sheet.createRow(6); for (k = 0; k < t_uti.length; k++) { celda = fila.createCell(k); celda.setCellValue(t_uti[k]); } fila = sheet.createRow(7); for (k = 0; k < d_uti.length; k++) { celda = fila.createCell(k); celda.setCellValue(d_uti[k]); } try { FileOutputStream out = new FileOutputStream(archivo); workbook.write(out); out.close(); System.out.println("Archivo creado exitosamente!"); } catch (IOException ex) { System.out.println("Error de escritura"); ex.printStackTrace(); } } }); archivo.add(guardar); menu.add(archivo); frame_grafica.getContentPane().add(panel_grafica); frame_grafica.setBounds(60, 60, 450, 400); frame_grafica.setJMenuBar(menu); frame_grafica.setVisible(true); frame_grafica.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); } if (combobox.getSelectedIndex() == 5) { datos_rec_hum.addValue(d_rh_a_lu, "Asistencias", "Lunes"); datos_rec_hum.addValue(d_rh_a_ma, "Asistencias", "Martes"); datos_rec_hum.addValue(d_rh_a_mi, "Asistencias", "Mircoles"); datos_rec_hum.addValue(d_rh_a_ju, "Asistencias", "Jueves"); datos_rec_hum.addValue(d_rh_a_vi, "Asistencias", "Viernes"); datos_rec_hum.addValue(d_rh_a_sa, "Asistencias", "Sbado"); datos_rec_hum.addValue(d_rh_a_do, "Asistencias", "Domingo"); datos_rec_hum.addValue(d_rh_r_lu, "Retardos", "Lunes"); datos_rec_hum.addValue(d_rh_r_ma, "Retardos", "Martes"); datos_rec_hum.addValue(d_rh_r_mi, "Retardos", "Mircoles"); datos_rec_hum.addValue(d_rh_r_ju, "Retardos", "Jueves"); datos_rec_hum.addValue(d_rh_r_vi, "Retardos", "Viernes"); datos_rec_hum.addValue(d_rh_r_sa, "Retardos", "Sbado"); datos_rec_hum.addValue(d_rh_r_do, "Retardos", "Domingo"); datos_rec_hum.addValue(d_rh_f_lu, "Faltas", "Lunes"); datos_rec_hum.addValue(d_rh_f_ma, "Faltas", "Martes"); datos_rec_hum.addValue(d_rh_f_mi, "Faltas", "Mircoles"); datos_rec_hum.addValue(d_rh_f_ju, "Faltas", "Jueves"); datos_rec_hum.addValue(d_rh_f_vi, "Faltas", "Viernes"); datos_rec_hum.addValue(d_rh_f_sa, "Faltas", "Sbado"); datos_rec_hum.addValue(d_rh_f_do, "Faltas", "Domingo"); Grafica = ChartFactory.createBarChart3D("Recursos Humanos", "Das", "Nmero de Empleados", datos_rec_hum, PlotOrientation.VERTICAL, true, true, false); ChartPanel panel_grafica = new ChartPanel(Grafica); JFrame frame_grafica = new JFrame("Grfico"); JMenuBar menu = new JMenuBar(); JMenu archivo = new JMenu("Archivo"); JMenuItem guardar = new JMenuItem("Guardar como reporte..."); guardar.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Document document = new Document(); PdfWriter writer = null; try { writer = PdfWriter.getInstance(document, new FileOutputStream("Grfico Recursos Humanos.pdf")); } catch (DocumentException ex) { Logger.getLogger(JFrame.class.getName()).log(Level.SEVERE, null, ex); } catch (FileNotFoundException ex) { Logger.getLogger(JFrame.class.getName()).log(Level.SEVERE, null, ex); } document.open(); PdfContentByte cb = writer.getDirectContent(); PdfTemplate tp = cb.createTemplate(450, 450); Graphics2D g2 = tp.createGraphicsShapes(450, 450); menu.setVisible(false); frame_grafica.print(g2); menu.setVisible(true); g2.dispose(); cb.addTemplate(tp, 30, 400); document.close(); HSSFWorkbook workbook = new HSSFWorkbook(); HSSFSheet sheet = workbook.createSheet("Reporte de Recursos Humanos"); Row fila = sheet.createRow(0); File archivo = new File("Reporte de Recursos Humanos.xls"); Cell celda; String[] t_asi = { "A lunes", "A martes", "A miercoles", "A jueves", "A viernes", "A sabado", "A domingo" }; String[] t_ret = { "R lunes", "R martes", "R miercoles", "R jueves", "R viernes", "R sabado", "R domingo" }; String[] t_fal = { "F lunes", "F martes", "F miercoles", "F jueves", "F viernes", "F sabado", "F domingo" }; int[] d_asi = { d_rh_a_lu, d_rh_a_ma, d_rh_a_mi, d_rh_a_ju, d_rh_a_vi, d_rh_a_sa, d_rh_a_do }; int[] d_ret = { d_rh_r_lu, d_rh_r_ma, d_rh_r_mi, d_rh_r_ju, d_rh_r_vi, d_rh_r_sa, d_rh_r_do }; int[] d_fal = { d_rh_f_lu, d_rh_r_ma, d_rh_r_mi, d_rh_r_ju, d_rh_r_vi, d_rh_r_sa, d_rh_r_do }; int i, j, k; for (i = 0; i < t_asi.length; i++) { celda = fila.createCell(i); celda.setCellValue(t_asi[i]); } fila = sheet.createRow(1); for (i = 0; i < d_asi.length; i++) { celda = fila.createCell(i); celda.setCellValue(d_asi[i]); } fila = sheet.createRow(3); for (j = 0; j < t_ret.length; j++) { celda = fila.createCell(j); celda.setCellValue(t_ret[j]); } fila = sheet.createRow(4); for (j = 0; j < d_ret.length; j++) { celda = fila.createCell(j); celda.setCellValue(d_ret[j]); } fila = sheet.createRow(6); for (k = 0; k < t_fal.length; k++) { celda = fila.createCell(k); celda.setCellValue(t_fal[k]); } fila = sheet.createRow(7); for (k = 0; k < d_fal.length; k++) { celda = fila.createCell(k); celda.setCellValue(d_fal[k]); } try { FileOutputStream out = new FileOutputStream(archivo); workbook.write(out); out.close(); System.out.println("Archivo creado exitosamente!"); } catch (IOException ex) { System.out.println("Error de escritura"); ex.printStackTrace(); } } }); archivo.add(guardar); menu.add(archivo); frame_grafica.getContentPane().add(panel_grafica); frame_grafica.setBounds(60, 60, 450, 400); frame_grafica.setJMenuBar(menu); frame_grafica.setVisible(true); frame_grafica.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); } } }); jPanel = new JPanel(); jPanel.setLayout(null); jPanel.add(cal1); jPanel.add(cal2); jPanel.add(etiqueta); jPanel.add(combobox); jPanel.add(calendario); jPanel.add(aceptar); jFrame.setJMenuBar(jMenuBar); jFrame.add(jPanel); jFrame.setVisible(true); }
From source file:com.rapidminer.gui.viewer.metadata.AttributeStatisticsPanel.java
/** * Initializes the GUI.//from ww w . j ava 2s . c o m * */ @SuppressWarnings({ "unchecked", "rawtypes" }) private void initGUI() { setLayout(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); // add attribute name panelAttName = new JPanel(); panelAttName.setLayout(new BoxLayout(panelAttName, BoxLayout.PAGE_AXIS)); panelAttName.setOpaque(false); // this border is to visualize that the name column can be enlarged/shrinked panelAttName.setBorder(BorderFactory.createMatteBorder(0, 0, 0, 1, Color.LIGHT_GRAY)); labelAttHeader = new JLabel(LABEL_DOTS); labelAttHeader.setFont(labelAttHeader.getFont().deriveFont(FONT_SIZE_LABEL_HEADER)); labelAttHeader.setForeground(Color.GRAY); panelAttName.add(labelAttHeader); labelAttName = new JLabel(LABEL_DOTS); labelAttName.setFont(labelAttName.getFont().deriveFont(Font.BOLD, FONT_SIZE_LABEL_VALUE)); labelAttName.setMinimumSize(DIMENSION_LABEL_ATTRIBUTE); labelAttName.setPreferredSize(DIMENSION_LABEL_ATTRIBUTE); panelAttName.add(labelAttName); gbc.gridx = 0; gbc.gridy = 0; gbc.insets = new Insets(3, 20, 3, 10); gbc.anchor = GridBagConstraints.CENTER; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.weightx = 0.0; gbc.weighty = 1.0; gbc.gridheight = 2; add(panelAttName, gbc); // create value type name and bring it to a nice to read format (aka uppercase first letter // and replace '_' with ' ' gbc.gridx += 1; gbc.insets = new Insets(5, 15, 5, 10); labelAttType = new JLabel(LABEL_DOTS); labelAttType.setMinimumSize(DIMENSION_LABEL_TYPE); labelAttType.setPreferredSize(DIMENSION_LABEL_TYPE); add(labelAttType, gbc); // missings panel JPanel panelStatsMissing = new JPanel(); panelStatsMissing.setLayout(new BoxLayout(panelStatsMissing, BoxLayout.PAGE_AXIS)); panelStatsMissing.setOpaque(false); labelStatsMissing = new JLabel(LABEL_DOTS); labelStatsMissing.setMinimumSize(DIMENSION_LABEL_MISSINGS); labelStatsMissing.setPreferredSize(DIMENSION_LABEL_MISSINGS); panelStatsMissing.add(labelStatsMissing); gbc.gridx += 1; gbc.fill = GridBagConstraints.NONE; gbc.weightx = 0.0; add(panelStatsMissing, gbc); // chart panel(s) (only visible when enlarged) JPanel chartPanel = new JPanel(new BorderLayout()); chartPanel.setBackground(COLOR_TRANSPARENT); chartPanel.setOpaque(false); listOfChartPanels.add(chartPanel); updateVisibilityOfChartPanels(); gbc.fill = GridBagConstraints.NONE; gbc.weighty = 0.0; gbc.insets = new Insets(0, 10, 0, 10); for (JPanel panel : listOfChartPanels) { gbc.gridx += 1; add(panel, gbc); } // (hidden) construction panel String constructionLabel = I18N.getMessage(I18N.getGUIBundle(), "gui.label.attribute_statistics.statistics.construction.label"); panelStatsConstruction = new JPanel(); panelStatsConstruction.setLayout(new BoxLayout(panelStatsConstruction, BoxLayout.PAGE_AXIS)); panelStatsConstruction.setOpaque(false); panelStatsConstruction.setVisible(false); JLabel labelConstructionHeader = new JLabel(constructionLabel); labelConstructionHeader.setFont(labelConstructionHeader.getFont().deriveFont(FONT_SIZE_LABEL_HEADER)); labelConstructionHeader.setForeground(Color.GRAY); panelStatsConstruction.add(labelConstructionHeader); labelStatsConstruction = new JLabel(LABEL_DOTS); labelStatsConstruction.setFont(labelStatsConstruction.getFont().deriveFont(FONT_SIZE_LABEL_VALUE)); labelStatsConstruction.setMinimumSize(DIMENSION_LABEL_CONSTRUCTION); labelStatsConstruction.setPreferredSize(DIMENSION_LABEL_CONSTRUCTION); panelStatsConstruction.add(labelStatsConstruction); gbc.gridx += 1; gbc.fill = GridBagConstraints.NONE; gbc.weightx = 0.0; add(panelStatsConstruction, gbc); // statistics panel, contains different statistics panels for numerical/nominal/date_time on // a card layout // needed to switch between for model swapping cardStatsPanel = new JPanel(); cardStatsPanel.setOpaque(false); cardLayout = new CardLayout(); cardStatsPanel.setLayout(cardLayout); // numerical version JPanel statsNumPanel = new JPanel(); GridBagLayout layout = new GridBagLayout(); GridBagConstraints gbcStatPanel = new GridBagConstraints(); statsNumPanel.setLayout(layout); statsNumPanel.setOpaque(false); String avgLabel = I18N.getMessage(I18N.getGUIBundle(), "gui.label.attribute_statistics.statistics.avg.label"); String devianceLabel = I18N.getMessage(I18N.getGUIBundle(), "gui.label.attribute_statistics.statistics.variance.label"); String minLabel = I18N.getMessage(I18N.getGUIBundle(), "gui.label.attribute_statistics.statistics.min.label"); String maxLabel = I18N.getMessage(I18N.getGUIBundle(), "gui.label.attribute_statistics.statistics.max.label"); // min value panel JPanel panelStatsMin = new JPanel(); panelStatsMin.setLayout(new BoxLayout(panelStatsMin, BoxLayout.PAGE_AXIS)); panelStatsMin.setOpaque(false); JLabel labelMinHeader = new JLabel(minLabel); labelMinHeader.setFont(labelMinHeader.getFont().deriveFont(FONT_SIZE_LABEL_HEADER)); labelMinHeader.setForeground(Color.GRAY); panelStatsMin.add(labelMinHeader); labelStatsMin = new JLabel(LABEL_DOTS); labelStatsMin.setFont(labelStatsMin.getFont().deriveFont(FONT_SIZE_LABEL_VALUE)); panelStatsMin.add(labelStatsMin); // max value panel JPanel panelStatsMax = new JPanel(); panelStatsMax.setLayout(new BoxLayout(panelStatsMax, BoxLayout.PAGE_AXIS)); panelStatsMax.setOpaque(false); JLabel labelMaxHeader = new JLabel(maxLabel); labelMaxHeader.setFont(labelMaxHeader.getFont().deriveFont(FONT_SIZE_LABEL_HEADER)); labelMaxHeader.setForeground(Color.GRAY); panelStatsMax.add(labelMaxHeader); labelStatsMax = new JLabel(LABEL_DOTS); labelStatsMax.setFont(labelStatsMax.getFont().deriveFont(FONT_SIZE_LABEL_VALUE)); panelStatsMax.add(labelStatsMax); // average value panel JPanel panelStatsAvg = new JPanel(); panelStatsAvg.setLayout(new BoxLayout(panelStatsAvg, BoxLayout.PAGE_AXIS)); panelStatsAvg.setOpaque(false); JLabel labelAvgHeader = new JLabel(avgLabel); labelAvgHeader.setFont(labelAvgHeader.getFont().deriveFont(FONT_SIZE_LABEL_HEADER)); labelAvgHeader.setForeground(Color.GRAY); panelStatsAvg.add(labelAvgHeader); labelStatsAvg = new JLabel(LABEL_DOTS); labelStatsAvg.setFont(labelStatsAvg.getFont().deriveFont(FONT_SIZE_LABEL_VALUE)); panelStatsAvg.add(labelStatsAvg); // deviance value panel JPanel panelStatsDeviance = new JPanel(); panelStatsDeviance.setLayout(new BoxLayout(panelStatsDeviance, BoxLayout.PAGE_AXIS)); panelStatsDeviance.setOpaque(false); JLabel labelDevianceHeader = new JLabel(devianceLabel); labelDevianceHeader.setFont(labelDevianceHeader.getFont().deriveFont(FONT_SIZE_LABEL_HEADER)); labelDevianceHeader.setForeground(Color.GRAY); panelStatsDeviance.add(labelDevianceHeader); labelStatsDeviation = new JLabel(LABEL_DOTS); labelStatsDeviation.setFont(labelStatsDeviation.getFont().deriveFont(FONT_SIZE_LABEL_VALUE)); panelStatsDeviance.add(labelStatsDeviation); // add sub panels to stats panel gbcStatPanel.gridx = 0; gbcStatPanel.weightx = 0.0; gbcStatPanel.fill = GridBagConstraints.NONE; gbcStatPanel.insets = new Insets(0, 0, 0, 4); panelStatsMin.setPreferredSize(DIMENSION_PANEL_NUMERIC_PREF_SIZE); statsNumPanel.add(panelStatsMin, gbcStatPanel); gbcStatPanel.gridx += 1; panelStatsMax.setPreferredSize(DIMENSION_PANEL_NUMERIC_PREF_SIZE); statsNumPanel.add(panelStatsMax, gbcStatPanel); gbcStatPanel.gridx += 1; panelStatsAvg.setPreferredSize(DIMENSION_PANEL_NUMERIC_PREF_SIZE); statsNumPanel.add(panelStatsAvg, gbcStatPanel); gbcStatPanel.gridx += 1; panelStatsDeviance.setPreferredSize(DIMENSION_PANEL_NUMERIC_PREF_SIZE); statsNumPanel.add(panelStatsDeviance, gbcStatPanel); gbcStatPanel.gridx += 1; gbcStatPanel.weightx = 1.0; gbcStatPanel.fill = GridBagConstraints.HORIZONTAL; statsNumPanel.add(new JLabel(), gbcStatPanel); cardStatsPanel.add(statsNumPanel, CARD_NUMERICAL); // nominal version JPanel statsNomPanel = new JPanel(); statsNomPanel.setLayout(layout); statsNomPanel.setOpaque(false); String leastLabel = I18N.getMessage(I18N.getGUIBundle(), "gui.label.attribute_statistics.statistics.least.label"); String mostLabel = I18N.getMessage(I18N.getGUIBundle(), "gui.label.attribute_statistics.statistics.most.label"); String valuesLabel = I18N.getMessage(I18N.getGUIBundle(), "gui.label.attribute_statistics.statistics.values.label"); // least panel JPanel panelStatsLeast = new JPanel(); panelStatsLeast.setLayout(new BoxLayout(panelStatsLeast, BoxLayout.PAGE_AXIS)); panelStatsLeast.setOpaque(false); JLabel labelLeastHeader = new JLabel(leastLabel); labelLeastHeader.setFont(labelLeastHeader.getFont().deriveFont(FONT_SIZE_LABEL_HEADER)); labelLeastHeader.setForeground(Color.GRAY); labelLeastHeader.setAlignmentX(Component.LEFT_ALIGNMENT); panelStatsLeast.add(labelLeastHeader); labelStatsLeast = new JLabel(LABEL_DOTS); labelStatsLeast.setFont(labelStatsLeast.getFont().deriveFont(FONT_SIZE_LABEL_VALUE)); panelStatsLeast.add(labelStatsLeast); // most panel JPanel panelStatsMost = new JPanel(); panelStatsMost.setLayout(new BoxLayout(panelStatsMost, BoxLayout.PAGE_AXIS)); panelStatsMost.setOpaque(false); JLabel labelMostHeader = new JLabel(mostLabel); labelMostHeader.setFont(labelMostHeader.getFont().deriveFont(FONT_SIZE_LABEL_HEADER)); labelMostHeader.setForeground(Color.GRAY); labelMostHeader.setAlignmentX(Component.LEFT_ALIGNMENT); panelStatsMost.add(labelMostHeader); labelStatsMost = new JLabel(LABEL_DOTS); labelStatsMost.setFont(labelStatsMost.getFont().deriveFont(FONT_SIZE_LABEL_VALUE)); panelStatsMost.add(labelStatsMost); // values panel JPanel panelStatsValues = new JPanel(); panelStatsValues.setLayout(new BoxLayout(panelStatsValues, BoxLayout.PAGE_AXIS)); panelStatsValues.setOpaque(false); JLabel labelValuesHeader = new JLabel(valuesLabel); labelValuesHeader.setFont(labelValuesHeader.getFont().deriveFont(FONT_SIZE_LABEL_HEADER)); labelValuesHeader.setForeground(Color.GRAY); labelValuesHeader.setAlignmentX(Component.LEFT_ALIGNMENT); panelStatsValues.add(labelValuesHeader); labelStatsValues = new JLabel(LABEL_DOTS); labelStatsValues.setFont(labelStatsValues.getFont().deriveFont(FONT_SIZE_LABEL_VALUE)); panelStatsValues.add(labelStatsValues); detailsButton = new JButton(new ShowNomValueAction(this)); detailsButton.setVisible(false); detailsButton.setOpaque(false); detailsButton.setContentAreaFilled(false); detailsButton.setBorderPainted(false); detailsButton.addMouseListener(enlargeAndHoverAndPopupMouseAdapter); detailsButton.setHorizontalAlignment(SwingConstants.LEFT); detailsButton.setHorizontalTextPosition(SwingConstants.LEFT); detailsButton.setIcon(null); Font font = detailsButton.getFont(); Map attributes = font.getAttributes(); attributes.put(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_ON); detailsButton.setFont(font.deriveFont(attributes)); panelStatsValues.add(detailsButton); // add sub panel to stats panel gbcStatPanel.gridx = 0; gbcStatPanel.weightx = 0.0; gbcStatPanel.fill = GridBagConstraints.NONE; gbcStatPanel.insets = new Insets(0, 0, 0, 6); panelStatsLeast.setPreferredSize(DIMENSION_PANEL_NOMINAL_PREF_SIZE); statsNomPanel.add(panelStatsLeast, gbcStatPanel); gbcStatPanel.gridx += 1; panelStatsMost.setPreferredSize(DIMENSION_PANEL_NOMINAL_PREF_SIZE); statsNomPanel.add(panelStatsMost, gbcStatPanel); gbcStatPanel.gridx += 1; statsNomPanel.add(panelStatsValues, gbcStatPanel); gbcStatPanel.gridx += 1; gbcStatPanel.weightx = 1.0; gbcStatPanel.fill = GridBagConstraints.HORIZONTAL; statsNomPanel.add(new JLabel(), gbcStatPanel); cardStatsPanel.add(statsNomPanel, CARD_NOMINAL); // date_time version JPanel statsDateTimePanel = new JPanel(); statsDateTimePanel.setLayout(layout); statsDateTimePanel.setOpaque(false); String durationLabel = I18N.getMessage(I18N.getGUIBundle(), "gui.label.attribute_statistics.statistics.duration.label"); String fromLabel = I18N.getMessage(I18N.getGUIBundle(), "gui.label.attribute_statistics.statistics.from.label"); String untilLabel = I18N.getMessage(I18N.getGUIBundle(), "gui.label.attribute_statistics.statistics.until.label"); // min value panel JPanel panelStatsFrom = new JPanel(); panelStatsFrom.setLayout(new BoxLayout(panelStatsFrom, BoxLayout.PAGE_AXIS)); panelStatsFrom.setOpaque(false); JLabel labelFromHeader = new JLabel(fromLabel); labelFromHeader.setFont(labelFromHeader.getFont().deriveFont(FONT_SIZE_LABEL_HEADER)); labelFromHeader.setForeground(Color.GRAY); panelStatsFrom.add(labelFromHeader); labelStatsFrom = new JLabel(LABEL_DOTS); labelStatsFrom.setFont(labelStatsFrom.getFont().deriveFont(FONT_SIZE_LABEL_VALUE)); panelStatsFrom.add(labelStatsFrom); // until value panel JPanel panelStatsUntil = new JPanel(); panelStatsUntil.setLayout(new BoxLayout(panelStatsUntil, BoxLayout.PAGE_AXIS)); panelStatsUntil.setOpaque(false); JLabel labelUntilHeader = new JLabel(untilLabel); labelUntilHeader.setFont(labelUntilHeader.getFont().deriveFont(FONT_SIZE_LABEL_HEADER)); labelUntilHeader.setForeground(Color.GRAY); panelStatsUntil.add(labelUntilHeader); labelStatsUntil = new JLabel(LABEL_DOTS); labelStatsUntil.setFont(labelStatsUntil.getFont().deriveFont(FONT_SIZE_LABEL_VALUE)); panelStatsUntil.add(labelStatsUntil); // duration value panel JPanel panelStatsDuration = new JPanel(); panelStatsDuration.setLayout(new BoxLayout(panelStatsDuration, BoxLayout.PAGE_AXIS)); panelStatsDuration.setOpaque(false); JLabel labelDurationHeader = new JLabel(durationLabel); labelDurationHeader.setFont(labelDurationHeader.getFont().deriveFont(FONT_SIZE_LABEL_HEADER)); labelDurationHeader.setForeground(Color.GRAY); panelStatsDuration.add(labelDurationHeader); labelStatsDuration = new JLabel(LABEL_DOTS); labelStatsDuration.setFont(labelStatsDuration.getFont().deriveFont(FONT_SIZE_LABEL_VALUE)); panelStatsDuration.add(labelStatsDuration); // add sub panels to stats panel gbcStatPanel.gridx = 0; gbcStatPanel.weightx = 0.0; gbcStatPanel.fill = GridBagConstraints.NONE; gbcStatPanel.insets = new Insets(0, 0, 0, 6); panelStatsFrom.setPreferredSize(DIMENSION_PANEL_DATE_PREF_SIZE); statsDateTimePanel.add(panelStatsFrom, gbcStatPanel); gbcStatPanel.gridx += 1; panelStatsUntil.setPreferredSize(DIMENSION_PANEL_DATE_PREF_SIZE); statsDateTimePanel.add(panelStatsUntil, gbcStatPanel); gbcStatPanel.gridx += 1; panelStatsDuration.setPreferredSize(DIMENSION_PANEL_DATE_PREF_SIZE); statsDateTimePanel.add(panelStatsDuration, gbcStatPanel); gbcStatPanel.gridx += 1; gbcStatPanel.weightx = 1.0; gbcStatPanel.fill = GridBagConstraints.HORIZONTAL; statsDateTimePanel.add(new JLabel(), gbcStatPanel); cardStatsPanel.add(statsDateTimePanel, CARD_DATE_TIME); // add stats panel to main gui gbc.gridx += 1; gbc.insets = new Insets(5, 10, 5, 10); gbc.fill = GridBagConstraints.HORIZONTAL; gbc.weightx = 1.0; gbc.weighty = 0.0; gbc.anchor = GridBagConstraints.WEST; add(cardStatsPanel, gbc); // needed so we can draw our own background setOpaque(false); // handle mouse events for hover effect and enlarging/shrinking addMouseListener(enlargeAndHoverAndPopupMouseAdapter); // change cursor to indicate this component can be clicked setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); }
From source file:org.pentaho.support.standalone.SDSupportUtility.java
/** * initializing UI//from w w w. j av a 2 s . c o m * * @throws Exception */ public SDSupportUtility() throws Exception { prop = loadProperty(); setResizable(false); setTitle(SDConstant.PENT_SUP_WIZARD); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 665, 516); contentPane = new JPanel(); contentPane.setBackground(UIManager.getColor("Button.background")); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); contentPane.setLayout(null); JLabel lblLastAttached = new JLabel("Last Attached"); lblLastAttached.setOpaque(false); lblLastAttached.setHorizontalAlignment(SwingConstants.LEFT); lblLastAttached.setBounds(322, 335, 127, 23); contentPane.add(lblLastAttached); JLabel lblPentahoCustomerSupport = new JLabel("Pentaho Customer Support Wizard"); lblPentahoCustomerSupport.setForeground(new Color(51, 51, 51)); lblPentahoCustomerSupport.setVerticalAlignment(SwingConstants.TOP); lblPentahoCustomerSupport.setHorizontalAlignment(SwingConstants.RIGHT); lblPentahoCustomerSupport.setFont(new Font("Tahoma", Font.BOLD, 23)); lblPentahoCustomerSupport.setBounds(130, 109, 506, 37); contentPane.add(lblPentahoCustomerSupport); JLabel lbllogo = new JLabel(); lbllogo.setIcon(new ImageIcon( SDSupportUtility.class.getResource("/org/pentaho/support/standalone/puc-login-logo.png"))); lbllogo.setBounds(10, 11, 409, 93); contentPane.add(lbllogo); chckbxNewCheckBoxEnvironment = new JCheckBox("Environment"); chckbxNewCheckBoxEnvironment.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { ArgList.add(SDConstant.ENVIRONMENT); } else { ArgList.remove(SDConstant.ENVIRONMENT); } } }); chckbxNewCheckBoxEnvironment.setBounds(109, 268, 243, 23); contentPane.add(chckbxNewCheckBoxEnvironment); chckbxNewCheckBoxEnvironment.setOpaque(false); chckbxNewCheckBoxStructure = new JCheckBox("Structure Details"); chckbxNewCheckBoxStructure.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { ArgList.add(SDConstant.STRUCT); } else { ArgList.remove(SDConstant.STRUCT); } } }); chckbxNewCheckBoxStructure.setBounds(377, 190, 248, 23); contentPane.add(chckbxNewCheckBoxStructure); chckbxNewCheckBoxStructure.setOpaque(false); chckbxLogs = new JCheckBox("Logs"); chckbxLogs.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { ArgList.add(SDConstant.LOGS); } else { ArgList.remove(SDConstant.LOGS); } } }); chckbxLogs.setBounds(377, 164, 248, 23); contentPane.add(chckbxLogs); chckbxLogs.setOpaque(false); chckbxGetSecureFiles = new JCheckBox("Secure Files"); chckbxGetSecureFiles.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { ArgList.add(SDConstant.SECURITY); } else { ArgList.remove(SDConstant.SECURITY); } } }); chckbxGetSecureFiles.setBounds(109, 190, 243, 23); contentPane.add(chckbxGetSecureFiles); chckbxGetSecureFiles.setOpaque(false); chckbxMd5 = new JCheckBox("MD5 Hash Value"); chckbxMd5.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { ArgList.add(SDConstant.MD5); } else { ArgList.remove(SDConstant.MD5); } } }); chckbxMd5.setBounds(109, 216, 243, 23); contentPane.add(chckbxMd5); chckbxMd5.setOpaque(false); chckbxDbdetails = new JCheckBox("Datasource Details"); chckbxDbdetails.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { ArgList.add(SDConstant.DATASOURCE); } else { ArgList.remove(SDConstant.DATASOURCE); } } }); chckbxDbdetails.setBounds(109, 294, 243, 23); contentPane.add(chckbxDbdetails); chckbxDbdetails.setOpaque(false); chckbxLicense = new JCheckBox("License File"); chckbxLicense.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { ArgList.add(SDConstant.LICENSE); } else { ArgList.remove(SDConstant.LICENSE); } } }); chckbxLicense.setBounds(109, 164, 243, 23); contentPane.add(chckbxLicense); chckbxLicense.setOpaque(false); chckbxProcesslist = new JCheckBox("Running Process"); chckbxProcesslist.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { ArgList.add(SDConstant.RUNNING_TASK); } else { ArgList.remove(SDConstant.RUNNING_TASK); } } }); chckbxProcesslist.setBounds(109, 242, 243, 23); contentPane.add(chckbxProcesslist); chckbxProcesslist.setOpaque(false); chckbxTomcatxml = new JCheckBox("XML files from Tomcat"); chckbxTomcatxml.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { ArgList.add(SDConstant.FILE); tomcatXml = true; } else { ArgList.remove(SDConstant.FILE); tomcatXml = false; } } }); chckbxTomcatxml.setBounds(377, 242, 248, 23); contentPane.add(chckbxTomcatxml); chckbxTomcatxml.setOpaque(false); chckbxServerXml = new JCheckBox("XML files from Server"); chckbxServerXml.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { ArgList.add(SDConstant.FILE); serverXml = true; } else { ArgList.remove(SDConstant.FILE); serverXml = false; } } }); chckbxServerXml.setBounds(377, 216, 248, 23); contentPane.add(chckbxServerXml); chckbxServerXml.setOpaque(false); chckbxGetBatfiles = new JCheckBox("Start up files from server"); chckbxGetBatfiles.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { ArgList.add(SDConstant.FILE); serverBatFile = true; } else { ArgList.remove(SDConstant.FILE); serverBatFile = false; } } }); chckbxGetBatfiles.setBounds(377, 268, 248, 23); contentPane.add(chckbxGetBatfiles); chckbxGetBatfiles.setOpaque(false); chckbxServerproperties = new JCheckBox("Properites files from server"); chckbxServerproperties.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { ArgList.add(SDConstant.FILE); serverProrperties = true; } else { ArgList.remove(SDConstant.FILE); serverProrperties = false; } } }); chckbxServerproperties.setBounds(377, 294, 248, 23); contentPane.add(chckbxServerproperties); chckbxServerproperties.setOpaque(false); btnNewButton = new JButton("Package"); btnNewButton.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent arg0) { try { if (installType.equalsIgnoreCase("Manual")) { if (prop.getProperty(SDConstant.BI_TOM_PATH) == null) { JOptionPane.showMessageDialog(contentPane, SDConstant.ERROR_12, "Inane error", JOptionPane.ERROR_MESSAGE); } else { WEB_XML = new StringBuilder(); WEB_XML.append(prop.getProperty(SDConstant.BI_TOM_PATH)).append(File.separator) .append(SDConstant.WEB_APP).append(File.separator).append(SDConstant.PENTAHO) .append(File.separator).append(SDConstant.WEB_INF).append(File.separator) .append(SDConstant.WEB_XML); PENTAHO_SOLU_PATH = getSolutionPath("biserver", WEB_XML.toString()); prop.put(SDConstant.PENTAHO_SOLU_PATH, PENTAHO_SOLU_PATH); prop.put(SDConstant.BI_PATH, PENTAHO_SOLU_PATH); } } if (prop.getProperty(SDConstant.BI_PATH) == null) { JOptionPane.showMessageDialog(contentPane, SDConstant.ERROR_1, "Inane error", JOptionPane.ERROR_MESSAGE); } if (prop.getProperty(SDConstant.BI_TOM_PATH) == null) { JOptionPane.showMessageDialog(contentPane, SDConstant.ERROR_12, "Inane error", JOptionPane.ERROR_MESSAGE); } disableAll(); setBIServerPath(prop); final String data = textFieldBrowser.getText(); if (!data.equalsIgnoreCase(null)) { ArgList.add(SDConstant.BROWSER); } String[] array = new String[ArgList.size()]; int count = 0; for (int i = 0; i < ArgList.size(); i++) { String retName = ArgList.get(i); if (retName.equals("file")) { if (count == 0) { array[i] = retName; count++; } } else { array[i] = retName; } } ApplicationContext context = new ClassPathXmlApplicationContext(SDConstant.SPRNG_FILE_NAME); factory = (CofingRetrieverFactory) context.getBean("cofingRetrieverFactory"); ConfigRetreiver[] config = factory.getConfigRetrevier(array); ExecutorService service = Executors.newFixedThreadPool(10); for (final ConfigRetreiver configobj : config) { if (null != configobj) { configobj.setBISeverPath(prop); configobj.setServerName("biserver"); if (installType.equalsIgnoreCase("Installer")) { configobj.setInstallType("Installer"); } else if (installType.equalsIgnoreCase("Archive")) { configobj.setInstallType("Archive"); } else if (installType.equalsIgnoreCase("Manual")) { configobj.setInstallType("Manual"); } if (configobj instanceof FileRetriever) { configobj.setBidiXml(serverXml); configobj.setBidiBatFile(serverBatFile); configobj.setBidiProrperties(serverProrperties); configobj.setTomcatXml(tomcatXml); } if (configobj instanceof BrowserInfoRetriever) { configobj.setBrowserInfo(data); } service.execute(new Runnable() { public void run() { if (null != configobj) configobj.readAndSaveConfiguration(prop); } }); } } btnNewButton.setVisible(false); progressBar.setVisible(true); ProgressThread thread = new ProgressThread(); thread.setSupport(getSupport()); thread.setProp(prop); new Thread(thread).start(); service.shutdown(); } catch (Exception e1) { e1.printStackTrace(); } } }); chckbxSelectAll = new JCheckBox("Select/ De-select"); chckbxSelectAll.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { selectAll(); } else { deSelectAll(); } } }); chckbxSelectAll.setBounds(46, 138, 201, 23); chckbxSelectAll.setOpaque(false); contentPane.add(chckbxSelectAll); btnNewButton.setForeground(SystemColor.infoText); btnNewButton.setBounds(10, 430, 639, 37); contentPane.add(btnNewButton); chckbxServerproperties.setOpaque(false); JLabel lblAttach = new JLabel("Attach Artifact"); lblAttach.setHorizontalAlignment(SwingConstants.LEFT); lblAttach.setBounds(32, 335, 177, 23); contentPane.add(lblAttach); lblAttach.setOpaque(false); JButton btnNewButtonBrowse = new JButton("Browse"); btnNewButtonBrowse.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent arg0) { saveSelectedFile(prop); JFrame parentFrame = new JFrame(); JFileChooser fileChooser = new JFileChooser(); fileChooser.setDialogTitle("Specify a file to save"); fileChooser.setMultiSelectionEnabled(true); int userSelection = fileChooser.showSaveDialog(parentFrame); if (userSelection == JFileChooser.APPROVE_OPTION) { fileToSave = fileChooser.getSelectedFiles(); for (int i = 0; i < fileToSave.length; i++) { File file = fileToSave[i]; String artifactpath = file.getAbsolutePath(); File f = new File(artifactpath); String absolutefilename = f.getName(); String filename = ArtifactsDirectory.concat(absolutefilename); CopyFile artifactcopy = new CopyFile(artifactpath, filename); try { artifactcopy.copy(); } catch (Exception e1) { e1.printStackTrace(); } } uploadedFiles(); rowList = new JList(model); listScrollPane.setViewportView(rowList); panel.add(listScrollPane); } rowList.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { lblDelete.setVisible(true); } }); } }); btnNewButtonBrowse.setBounds(208, 335, 104, 23); contentPane.add(btnNewButtonBrowse); btnNewButtonBrowse.setOpaque(false); textFieldBrowser = new JTextField(); textFieldBrowser.setBounds(208, 364, 441, 23); contentPane.add(textFieldBrowser); textFieldBrowser.setColumns(10); progressBar = new JProgressBar(0, 100); progressBar.setBounds(8, 437, 639, 24); progressBar.setVisible(false); progressBar.setStringPainted(true); contentPane.add(progressBar); JLabel lblBrowserInformation = new JLabel("Browser Information"); lblBrowserInformation.setHorizontalAlignment(SwingConstants.LEFT); lblBrowserInformation.setLabelFor(textFieldBrowser); lblBrowserInformation.setBounds(32, 368, 174, 14); contentPane.add(lblBrowserInformation); panel = new JPanel(); panel.setBounds(423, 325, 127, 33); contentPane.add(panel); panel.setLayout(null); listScrollPane = new JScrollPane(); listScrollPane.setBounds(0, 0, 127, 33); panel.add(listScrollPane); lblDelete = new JLabel(""); lblDelete.setBounds(552, 325, 22, 23); lblDelete.setVisible(false); lblDelete.setIcon( new ImageIcon(SDSupportUtility.class.getResource("/org/pentaho/support/standalone/remove.png"))); contentPane.add(lblDelete); lblDelete.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { int option = JOptionPane.showConfirmDialog(null, "Are you sure you want to delete this file ?"); if (option == JOptionPane.YES_OPTION) { String sel = rowList.getSelectedValue().toString(); String selected = dir + "/" + sel; File fileExists = new File(selected); fileExists.delete(); model.remove(sel.indexOf(sel)); lblDelete.setVisible(false); } } }); JLabel instalType = new JLabel("Installation Type : "); instalType.setBounds(32, 395, 177, 23); instalType.setVisible(true); contentPane.add(instalType); ButtonGroup btnGrp = new ButtonGroup(); rdbtnInstaller = new JRadioButton("Installer"); rdbtnInstaller.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { installType = "Installer"; } }); rdbtnInstaller.setBounds(208, 395, 104, 23); rdbtnInstaller.setSelected(true); contentPane.add(rdbtnInstaller); btnGrp.add(rdbtnInstaller); rdbtnArchive = new JRadioButton("Archive"); rdbtnArchive.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { installType = "Archive"; } }); rdbtnArchive.setBounds(333, 395, 104, 23); contentPane.add(rdbtnArchive); btnGrp.add(rdbtnArchive); rdbtnManual = new JRadioButton("Manual"); rdbtnManual.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { installType = "Manual"; } }); rdbtnManual.setBounds(460, 395, 127, 27); contentPane.add(rdbtnManual); btnGrp.add(rdbtnManual); JLabel lblBackground = new JLabel(); lblBackground.setIcon(new ImageIcon( SDSupportUtility.class.getResource("/org/pentaho/support/standalone/login-crystal-bg.jpg"))); lblBackground.setBackground(SystemColor.controlHighlight); lblBackground.setHorizontalAlignment(SwingConstants.CENTER); lblBackground.setBounds(0, 0, 659, 488); contentPane.add(lblBackground); }