List of usage examples for javax.swing JPanel setBackground
@BeanProperty(preferred = true, visualUpdate = true, description = "The background color of the component.") public void setBackground(Color bg)
From source file:com.polivoto.vistas.Charts.java
public void getHeader(JPanel header) { header.removeAll();/* w ww.jav a 2 s . c o m*/ GridBagConstraints gridBagConstraints; header.setLayout(new GridBagLayout()); header.setBackground(Color.white); header.setPreferredSize(new Dimension(0, 100)); JLabel titulo = new JLabel("<html> <b>Votacin: </b>" + votacion.getTitulo() + "</html>"); JLabel lugar = new JLabel("<html> <b>Lugar: </b>" + votacion.getLugar() + "</html>"); SimpleDateFormat sdf = new SimpleDateFormat("EEEE d' de 'MMMM' del 'yyyy, hh:mm:ss"); JLabel fechaInicio = new JLabel( "<html><b>Fecha de inicio: </b>" + sdf.format(new Date(votacion.getFechaInicio())) + "</html>"); JLabel fechaFin = new JLabel( "<html><b>Fecha de fin: </b>" + sdf.format(new Date(votacion.getFechaFin())) + "</html>"); titulo.setFont(fuenteNormal); titulo.setVerticalAlignment(JLabel.CENTER); lugar.setFont(fuenteNormal); lugar.setVerticalAlignment(JLabel.CENTER); fechaFin.setFont(fuenteNormal); fechaFin.setVerticalAlignment(JLabel.CENTER); fechaInicio.setFont(fuenteNormal); fechaInicio.setVerticalAlignment(JLabel.CENTER); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 1; gridBagConstraints.fill = GridBagConstraints.BOTH; gridBagConstraints.weightx = 0.1; gridBagConstraints.weighty = 0.1; gridBagConstraints.insets = new java.awt.Insets(5, 15, 5, 5); header.add(titulo, gridBagConstraints); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 3; gridBagConstraints.gridy = 1; gridBagConstraints.fill = GridBagConstraints.BOTH; gridBagConstraints.weightx = 0.1; gridBagConstraints.weighty = 0.1; gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 15); header.add(fechaInicio, gridBagConstraints); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 3; gridBagConstraints.fill = GridBagConstraints.BOTH; gridBagConstraints.weightx = 0.1; gridBagConstraints.weighty = 0.1; gridBagConstraints.insets = new java.awt.Insets(5, 15, 5, 5); header.add(lugar, gridBagConstraints); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 3; gridBagConstraints.gridy = 3; gridBagConstraints.fill = GridBagConstraints.BOTH; gridBagConstraints.weightx = 0.1; gridBagConstraints.weighty = 0.1; gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 15); header.add(fechaFin, gridBagConstraints); header.repaint(); header.revalidate(); }
From source file:be.ac.ua.comp.scarletnebula.gui.InteractiveFirewallPanel.java
public InteractiveFirewallPanel(final CloudProvider provider) { super(new BorderLayout()); this.provider = provider; ruleList = new RuleList(provider); final JPanel mainPanel = new JPanel(new GridBagLayout()); final GridBagConstraints c = new GridBagConstraints(); c.weightx = 0.25;/* w ww . j av a 2 s . c om*/ c.weighty = 1.0; c.fill = GridBagConstraints.BOTH; c.gridx = 0; c.gridy = 0; c.insets = new Insets(10, 10, 10, 5); final JPanel firewallPanel = new JPanel(new BorderLayout()); firewallPanel.add(firewallList, BorderLayout.CENTER); final JPanel firewallButtonPanel = new JPanel(); firewallButtonPanel.setLayout(new BoxLayout(firewallButtonPanel, BoxLayout.PAGE_AXIS)); firewallButtonPanel.setOpaque(true); firewallButtonPanel.setBackground(Color.white); addFirewallButton.setMaximumSize(new Dimension(500, 500)); addFirewallButton.addActionListener(new AddFirewallActionListener(provider)); firewallButtonPanel.add(addFirewallButton); deleteFirewallButton.setMaximumSize(new Dimension(500, 500)); deleteFirewallButton.addActionListener(new DeleteFirewallActionListener(provider)); firewallButtonPanel.add(deleteFirewallButton); firewallPanel.add(firewallButtonPanel, BorderLayout.PAGE_END); final JScrollPane firewallListScroller = new JScrollPane(firewallPanel); firewallPanel.setPreferredSize(new Dimension(10, 10)); mainPanel.add(firewallListScroller, c); c.weightx = 0.75; c.gridx = 1; c.insets = new Insets(10, 5, 10, 10); ruleList.setFillsViewportHeight(true); ruleList.setEnabled(false); firewallList.getSelectionModel().addListSelectionListener( new FirewallListSelectionListener(ruleList, addRulebutton, deleteRuleButton, deleteFirewallButton)); final JScrollPane ruleListScroller = new JScrollPane(ruleList); final JPanel ruleListPanel = new JPanel(new BorderLayout()); ruleListPanel.add(ruleListScroller, BorderLayout.CENTER); final JPanel ruleListButtonPanel = new JPanel(); addRulebutton.addActionListener(new AddRuleActionListener(provider)); deleteRuleButton.addActionListener(new DeleteRuleActionListener()); ruleListButtonPanel.add(addRulebutton); ruleListButtonPanel.add(deleteRuleButton); addRulebutton.setEnabled(false); deleteRuleButton.setEnabled(false); deleteFirewallButton.setEnabled(false); ruleListPanel.add(ruleListButtonPanel, BorderLayout.SOUTH); ruleListPanel.setPreferredSize(new Dimension(10, 10)); mainPanel.add(ruleListPanel, c); add(mainPanel, BorderLayout.CENTER); final JPanel allThrobbersPanel = getThrobbersPanel(); add(allThrobbersPanel, BorderLayout.NORTH); loadInitialFirewalls(); }
From source file:desmoj.extensions.visualization2d.engine.modelGrafic.StatisticGrafic.java
/** * Build content for animationType StatisticGrafic.ANIMATION_LastValue * @return/*w ww .ja v a 2 s .c o m*/ */ private JPanel buildLastValuePanel() { JPanel out = new JPanel(); out.setBackground(Grafic.COLOR_BACKGROUND); out.setOpaque(true); out.setLayout(new BorderLayout()); switch (this.statistic.getTypeIndex()) { case Statistic.INDEX_None: this.valueLabel = new JLabel(); this.valueLabel.setFont(Grafic.FONT_BIG); this.valueLabel.setForeground(Grafic.COLOR_FOREGROUND); out.add(this.valueLabel, BorderLayout.CENTER); if (this.isIntValue) out.setPreferredSize(new Dimension(80, 50)); else out.setPreferredSize(new Dimension(100, 50)); break; case Statistic.INDEX_Min_Max: this.valueLabel = new JLabel(); this.valueLabel.setFont(Grafic.FONT_BIG); this.valueLabel.setForeground(Grafic.COLOR_FOREGROUND); out.add(this.valueLabel, BorderLayout.CENTER); ; Box top = Box.createVerticalBox(); this.minLabel = new JLabel(); this.minLabel.setFont(Grafic.FONT_DEFAULT); this.minLabel.setForeground(Grafic.COLOR_FOREGROUND); top.add(this.minLabel); this.maxLabel = new JLabel(); this.maxLabel.setFont(Grafic.FONT_DEFAULT); this.maxLabel.setForeground(Grafic.COLOR_FOREGROUND); top.add(this.maxLabel); out.add(top, BorderLayout.SOUTH); if (this.isIntValue) out.setPreferredSize(new Dimension(80, 70)); else out.setPreferredSize(new Dimension(100, 70)); break; case Statistic.INDEX_Mean_StdDev: this.valueLabel = new JLabel(); this.valueLabel.setFont(Grafic.FONT_BIG); this.valueLabel.setForeground(Grafic.COLOR_FOREGROUND); out.add(this.valueLabel, BorderLayout.CENTER); ; Box bottom = Box.createVerticalBox(); this.meanLabel = new JLabel(); this.meanLabel.setFont(Grafic.FONT_DEFAULT); this.meanLabel.setForeground(Grafic.COLOR_FOREGROUND); bottom.add(this.meanLabel); this.stdDevLabel = new JLabel(); this.stdDevLabel.setFont(Grafic.FONT_DEFAULT); this.stdDevLabel.setForeground(Grafic.COLOR_FOREGROUND); bottom.add(this.stdDevLabel); out.add(bottom, BorderLayout.SOUTH); if (this.isIntValue) out.setPreferredSize(new Dimension(80, 70)); else out.setPreferredSize(new Dimension(100, 70)); break; } return out; }
From source file:com.prezerak.windmill.gui.AveragesPanel.java
private void initialize() { setLayout(new BorderLayout(0, 0)); JPanel controlsPanel = new JPanel(); controlsPanel.setBackground(UIManager.getColor("Button.background")); controlsPanel.setBorder(null);/*w w w . j a v a 2 s .c om*/ add(controlsPanel, BorderLayout.SOUTH); controlsPanel.setLayout(new FormLayout(new ColumnSpec[] { FormFactory.LABEL_COMPONENT_GAP_COLSPEC, ColumnSpec.decode("100px"), FormFactory.UNRELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, FormFactory.UNRELATED_GAP_COLSPEC, ColumnSpec.decode("101px"), FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("69px"), FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("left:max(46dlu;default)"), FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("max(25dlu;default)"), }, new RowSpec[] { FormFactory.NARROW_LINE_GAP_ROWSPEC, RowSpec.decode("23px"), FormFactory.LINE_GAP_ROWSPEC, RowSpec.decode("25px"), })); JButton btnReport = new JButton("Wind Report"); controlsPanel.add(btnReport, "2, 2, fill, fill"); btnReport.addActionListener(this); btnReport.setFont(new Font("Tahoma", Font.PLAIN, 11)); btnReport.setActionCommand("Report"); btnAlarmReport = new JButton("Alarm Report"); btnAlarmReport.setActionCommand("Alarm Report"); btnAlarmReport.addActionListener(this); btnAlarmReport.setFont(new Font("Tahoma", Font.PLAIN, 11)); controlsPanel.add(btnAlarmReport, "4, 2"); rdbtnVelocity = new JRadioButton("velocity"); controlsPanel.add(rdbtnVelocity, "10, 2, left, default"); rdbtnVelocity.setFont(new Font("Tahoma", Font.PLAIN, 11)); rdbtnVelocity.setSelected(true); rdbtnVelocity.addItemListener(this); rdbtnDirection = new JRadioButton("direction"); controlsPanel.add(rdbtnDirection, "12, 2, left, default"); rdbtnDirection.setFont(new Font("Tahoma", Font.PLAIN, 11)); rdbtnDirection.setSelected(true); rdbtnDirection.addItemListener(this); JButton btnPrintGraph = new JButton("Print Graph"); controlsPanel.add(btnPrintGraph, "2, 4, fill, top"); btnPrintGraph.setFont(new Font("Tahoma", Font.PLAIN, 11)); btnPrintGraph.setActionCommand("Print Graph"); btnPrintGraph.addActionListener(this); JButton btnBackToReal = new JButton("Back to Real Time "); controlsPanel.add(btnBackToReal, "4, 4, fill, top"); btnBackToReal.setFont(new Font("Tahoma", Font.PLAIN, 11)); btnBackToReal.setActionCommand("Back to Real"); btnBackToReal.addActionListener(this); rdbtnGust = new JRadioButton("Gust"); rdbtnGust.setSelected(true); rdbtnGust.addItemListener(this); rdbtnGust.setFont(new Font("Tahoma", Font.PLAIN, 11)); controlsPanel.add(rdbtnGust, "10, 4, left, default"); rdbtnHigh = new JRadioButton("High"); rdbtnHigh.setSelected(true); rdbtnHigh.addItemListener(this); rdbtnHigh.setFont(new Font("Tahoma", Font.PLAIN, 11)); controlsPanel.add(rdbtnHigh, "12, 4, left, default"); rdbtnHigher = new JRadioButton("Higher"); rdbtnHigher.setSelected(true); rdbtnHigher.setFont(new Font("Tahoma", Font.PLAIN, 11)); rdbtnHigher.addItemListener(this); controlsPanel.add(rdbtnHigher, "14, 4, left, default"); }
From source file:com.ibm.issw.odc.gui.BPMArgumentsPanel.java
/** * Create a panel containing the add and delete buttons. * * @return a GUI panel containing the buttons *//*from ww w . j a v a 2 s . c om*/ private JPanel makeButtonPanel() { JButton showDetail = new JButton(JMeterUtils.getResString("detail")); // $NON-NLS-1$ showDetail.setActionCommand(DETAIL); showDetail.setEnabled(true); add = new JButton(JMeterUtils.getResString("add")); // $NON-NLS-1$ add.setActionCommand(ADD); add.setEnabled(true); /** A button for adding new arguments to the table from the clipboard. */ JButton addFromClipboard = new JButton(JMeterUtils.getResString("add_from_clipboard")); // $NON-NLS-1$ addFromClipboard.setActionCommand(ADD_FROM_CLIPBOARD); addFromClipboard.setEnabled(true); delete = new JButton(JMeterUtils.getResString("delete")); // $NON-NLS-1$ delete.setActionCommand(DELETE); if (enableUpDown) { up = new JButton(JMeterUtils.getResString("up")); // $NON-NLS-1$ up.setActionCommand(UP); down = new JButton(JMeterUtils.getResString("down")); // $NON-NLS-1$ down.setActionCommand(DOWN); } checkDeleteStatus(); JPanel buttonPanel = new JPanel(); buttonPanel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 10)); if (this.background != null) { buttonPanel.setBackground(this.background); } showDetail.addActionListener(this); add.addActionListener(this); addFromClipboard.addActionListener(this); delete.addActionListener(this); buttonPanel.add(showDetail); buttonPanel.add(add); buttonPanel.add(addFromClipboard); buttonPanel.add(delete); if (enableUpDown) { up.addActionListener(this); down.addActionListener(this); buttonPanel.add(up); buttonPanel.add(down); } return buttonPanel; }
From source file:com.polivoto.vistas.Charts.java
private JPanel hacerTabla(Pregunta pregunta, List<Opcion> opciones, String perfil) { Tabla panel = new Tabla(); //Panel completo //scrollPanel.setBackground(Color.blue); //Ttulo pregunta JLabel tituloPregunta = new JLabel("\t" + pregunta.getTitulo() + " (" + perfil + ")"); tituloPregunta.setFont(new Font("Roboto", 1, 24)); tituloPregunta.setForeground(Color.black); tituloPregunta.setVerticalAlignment(JLabel.CENTER); JPanel panelHeader = panel.getjPanelHead(); panelHeader.add(tituloPregunta);//from w w w . j a va2 s .c o m panelHeader.setOpaque(false); panelHeader.setPreferredSize(panelGrafica.getSize()); //Panel de la tabla JPanel tabla = new JPanel(new GridLayout(pregunta.obtenerCantidadDeOpciones() + 2, 3, 5, 5)); tabla.setBackground(Color.white); //Poner el titulo de cada columna for (int i = 0; i < 3; i++) { JPanel tilt = new JPanel(); tilt.setBackground(new Color(137, 36, 31)); JLabel label = new JLabel(i == 0 ? "Opcion" : i == 2 ? "Porcentaje" : "Cantidad"); label.setFont(new Font("Roboto", 1, 18)); label.setForeground(Color.white); tilt.add(label); tilt.setSize(new Dimension(0, 35)); tilt.setBorder(new MatteBorder(1, 1, 1, 1, new Color(230, 230, 230))); tabla.add(tilt); } int sum = 0; for (Opcion opcion : opciones) { sum += opcion.getCantidad(); } for (Opcion opc : opciones) { JPanel p1 = new JPanel(new GridLayout(0, 1)); p1.setBackground(Color.white); p1.setBorder(new MatteBorder(1, 1, 1, 1, new Color(230, 230, 230))); JTextArea l1 = new JTextArea(opc.getNombre()); l1.setWrapStyleWord(true); l1.setLineWrap(true); l1.setFont(new Font("Roboto", 0, 18)); l1.setEditable(false); l1.setBorder(null); p1.setPreferredSize(l1.getSize()); p1.add(l1); tabla.add(p1); JPanel p2 = new JPanel(); p2.setBackground(Color.white); p2.setBorder(new MatteBorder(1, 1, 1, 1, new Color(230, 230, 230))); JLabel l2 = new JLabel("" + opc.getCantidad()); l2.setFont(new Font("Roboto", 0, 18)); p2.add(l2); tabla.add(p2); JPanel p3 = new JPanel(); p3.setBackground(Color.white); p3.setBorder(new MatteBorder(1, 1, 1, 1, new Color(230, 230, 230))); double porcentaje = (opc.getCantidad() * 100.0) / sum; JLabel l3 = new JLabel(String.format("%.2f", porcentaje) + "%"); l3.setFont(new Font("Roboto", 0, 18)); p3.add(l3); tabla.add(p3); } JPanel p1 = new JPanel(); p1.setBackground(Color.white); p1.setBorder(new MatteBorder(1, 1, 1, 1, new Color(230, 230, 230))); JLabel l1 = new JLabel("Total"); l1.setHorizontalTextPosition(JLabel.LEFT); l1.setFont(new Font("Roboto", 1, 18)); p1.add(l1); tabla.add(p1); JPanel p2 = new JPanel(); p2.setBackground(Color.white); p2.setBorder(new MatteBorder(1, 1, 1, 1, new Color(230, 230, 230))); JLabel l2 = new JLabel("" + sum); l2.setFont(new Font("Roboto", 1, 18)); p2.add(l2); tabla.add(p2); JPanel p3 = new JPanel(); p3.setBackground(Color.white); p3.setBorder(new MatteBorder(1, 1, 1, 1, new Color(230, 230, 230))); JLabel l3 = new JLabel("100.00%"); l3.setFont(new Font("Roboto", 1, 18)); p3.add(l3); tabla.add(p3); panel.getjPanelContent().add(tabla, BorderLayout.CENTER); //Relleno JPanel x = new JPanel(new GridLayout()); x.setPreferredSize(new Dimension(100, 0)); x.setBackground(Color.white); panel.getjPanelContent().add(x, BorderLayout.LINE_START); JPanel y = new JPanel(new GridLayout()); y.setPreferredSize(new Dimension(100, 0)); y.setBackground(Color.white); panel.getjPanelContent().add(y, BorderLayout.LINE_END); JPanel z = new JPanel(new GridLayout()); z.setBackground(Color.white); z.setPreferredSize(new Dimension(0, 40)); panel.getjPanelContent().add(z, BorderLayout.PAGE_END); return panel; }
From source file:com.mirth.connect.manager.ManagerDialog.java
private void initLayout() { setLayout(new MigLayout("insets 0 0 8 0, novisualpadding, hidemode 3")); add(new MirthHeadingPanel(), "wrap, grow"); servicePanel.add(startButton, "w 80!, h 22!, split"); servicePanel.add(startLabel, "wrap"); servicePanel.add(restartButton, "w 80!, h 22!, split"); servicePanel.add(restartLabel, "wrap"); servicePanel.add(stopButton, "w 80!, h 22!, split"); servicePanel.add(stopLabel, "wrap"); servicePanel.add(refreshButton, "w 80!, h 22!, split"); servicePanel.add(refreshLabel, "wrap"); servicePanel.add(startup, "span, push"); serverPanel.add(webstartPortLabel);/*from w w w.ja v a 2 s. c o m*/ serverPanel.add(webstartPortField, "w 55!, h 22!"); serverPanel.add(mainLogLevelLabel); serverPanel.add(mainLogLevelCombobox, "w 80!, wrap"); serverPanel.add(adminPortLabel); serverPanel.add(adminPortField, "w 55!, h 22!"); serverPanel.add(databaseLogLevelLabel); serverPanel.add(databaseLogLevelCombobox, "w 80!, wrap"); serverPanel.add(serverMemoryLabel); serverPanel.add(serverMemoryField, "w 55!, h 22!"); serverPanel.add(channelLogLevelLabel); serverPanel.add(channelLogLevelCombobox, "w 80!, wrap"); serverPanel.add(new JLabel("Log Files:")); serverPanel.add(serverLogsScrollPane, "w 205!, h 70!, span 2 2"); serverPanel.add(refreshServiceButton, "w 80!, h 22!, cell 3 3"); serverPanel.add(viewFileButton, "w 80!, h 22!, cell 3 4"); databasePanel.add(databaseTypeLabel); databasePanel.add(databaseTypeCombobox, "wrap"); databasePanel.add(databaseUrlLabel); databasePanel.add(databaseUrlField, "wrap, w 350!"); databasePanel.add(databaseUsernameLabel); databasePanel.add(databaseUsernameField, "wrap, w 145!"); databasePanel.add(passwordLabel); databasePanel.add(databasePasswordField, "w 145!"); infoPanel.add(serverVersionLabel); infoPanel.add(serverVersionField, "wrap"); infoPanel.add(serverIdLabel); infoPanel.add(serverIdField, "wrap"); infoPanel.add(javaVersionLabel); infoPanel.add(javaVersionField, "wrap"); infoPanel.add(contactPrefixLabel, "split 3, span, gaptop 90"); infoPanel.add(mirthSupportLink, "gaptop 90"); infoPanel.add(contactPostfixLabel, "gaptop 90"); JPanel tabContainer = new JPanel(new MigLayout("insets 8 8 0 8, novisualpadding, hidemode 3")); tabContainer.setBackground(Color.white); tabContainer.add(tabPanel); add(tabContainer, "wrap"); add(new JSeparator(), "newline, growx, sx, gapleft 8, gapright 8"); add(launchButton, "split, gapleft 8"); add(heapSizeButton, "w 22!, h 22!, left"); add(okButton, "w 56!, gapleft 145"); add(cancelButton, "w 56!"); add(applyButton, "w 56!"); }
From source file:com.polivoto.vistas.AnalistaLocal.java
private void setPreguntasText() { JSONArray js = accionesConsultor.getPreguntas(); for (int i = 0; i < js.length(); i++) { try {//from w w w. j ava2 s . c o m JPanel panel = new JPanel(new GridBagLayout()); panel.setBackground(new Color(255, 255, 255)); panelPreguntas.add(panel, "Pregunta " + (i + 1)); JLabel lab1 = new JLabel( "Pregunta " + (i + 1) + ": " + ((JSONObject) js.get(i)).getString("pregunta"), JLabel.CENTER); lab1.setFont(new Font("Roboto", 1, 18)); lab1.setForeground(new Color(134, 36, 31)); GridBagConstraints gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.weightx = 0.1; gridBagConstraints.weighty = 0.2; gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5); panel.add(lab1, gridBagConstraints); JSONArray jarr = ((JSONObject) js.get(i)).getJSONArray("opciones"); for (int j = 0; j < jarr.length(); j++) { JLabel lab2 = new JLabel("Opcin " + (j + 1) + ": " + jarr.getString(j), JLabel.CENTER); lab2.setFont(new Font("Roboto", 1, 15)); lab2.setForeground(new Color(0, 0, 0)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = j + 1; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.weightx = 0.1; gridBagConstraints.weighty = 0.1; gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5); panel.add(lab2, gridBagConstraints); } JPanel panelRelleno = new JPanel(new BorderLayout(20, 20)); panelRelleno.setBackground(Color.white); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = jarr.length() + 1; gridBagConstraints.fill = GridBagConstraints.BOTH; gridBagConstraints.weightx = 0.1; gridBagConstraints.weighty = 0.9; gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5); panel.add(panelRelleno, gridBagConstraints); } catch (JSONException ex) { Logger.getLogger(AnalistaLocal.class.getName()).log(Level.SEVERE, null, ex); } } cardsPreguntas.show(panelPreguntas, "Pregunta " + 1); }
From source file:ConfigFiles.java
public ConfigFiles(Dimension screensize) { // initializeFileBrowser(); paths = new JPanel(); paths.setBackground(Color.WHITE); //paths.setBorder(BorderFactory.createTitledBorder("Paths")); paths.setLayout(null);/*from ww w . java 2 s . c om*/ paths.setPreferredSize(new Dimension(930, 1144)); paths.setSize(new Dimension(930, 1144)); paths.setMinimumSize(new Dimension(930, 1144)); paths.setMaximumSize(new Dimension(930, 1144)); //paths.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED)); setLayout(null); ttcpath = new JTextField(); addPanel("TestCase Source Path", "Master directory with the test cases that can" + " be run by the framework", ttcpath, RunnerRepository.TESTSUITEPATH, 10, true, null); tMasterXML = new JTextField(); tUsers = new JTextField(); addPanel("Projects Path", "Location of projects XML files", tUsers, RunnerRepository.REMOTEUSERSDIRECTORY, 83, true, null); tSuites = new JTextField(); addPanel("Predefined Suites Path", "Location of predefined suites", tSuites, RunnerRepository.PREDEFINEDSUITES, 156, true, null); testconfigpath = new JTextField(); addPanel("Test Configuration Path", "Test Configuration path", testconfigpath, RunnerRepository.TESTCONFIGPATH, 303, true, null); tepid = new JTextField(); addPanel("EP name File", "Location of the file that contains" + " the Ep name list", tepid, RunnerRepository.REMOTEEPIDDIR, 595, true, null); tlog = new JTextField(); addPanel("Logs Path", "Location of the directory that stores the most recent log files." + " The files are re-used each Run.", tlog, RunnerRepository.LOGSPATH, 667, true, null); tsecondarylog = new JTextField(); JPanel p = addPanel("Secondary Logs Path", "Location of the directory that archives copies of the most recent log files, with" + " original file names appended with <.epoch time>", tsecondarylog, RunnerRepository.SECONDARYLOGSPATH, 930, true, null); logsenabled.setSelected(Boolean.parseBoolean(RunnerRepository.PATHENABLED)); logsenabled.setBackground(Color.WHITE); p.add(logsenabled); JPanel p7 = new JPanel(); p7.setBackground(Color.WHITE); TitledBorder border7 = BorderFactory.createTitledBorder("Log Files"); border7.setTitleFont(new Font("Arial", Font.PLAIN, 14)); border7.setBorder(BorderFactory.createLineBorder(new Color(150, 150, 150), 1)); p7.setBorder(border7); p7.setLayout(new BoxLayout(p7, BoxLayout.Y_AXIS)); p7.setBounds(80, 740, 800, 190); paths.add(p7); JTextArea log2 = new JTextArea("All the log files that will be monitored"); log2.setWrapStyleWord(true); log2.setLineWrap(true); log2.setEditable(false); log2.setCursor(null); log2.setOpaque(false); log2.setFocusable(false); log2.setBorder(null); log2.setFont(new Font("Arial", Font.PLAIN, 12)); log2.setBackground(getBackground()); log2.setMaximumSize(new Dimension(170, 25)); log2.setPreferredSize(new Dimension(170, 25)); JPanel p71 = new JPanel(); p71.setBackground(Color.WHITE); p71.setLayout(new GridLayout()); p71.setMaximumSize(new Dimension(700, 13)); p71.setPreferredSize(new Dimension(700, 13)); p71.add(log2); JPanel p72 = new JPanel(); p72.setBackground(Color.WHITE); p72.setLayout(new BoxLayout(p72, BoxLayout.Y_AXIS)); trunning = new JTextField(); p72.add(addField(trunning, "Running: ", 0)); tdebug = new JTextField(); p72.add(addField(tdebug, "Debug: ", 1)); tsummary = new JTextField(); p72.add(addField(tsummary, "Summary: ", 2)); tinfo = new JTextField(); p72.add(addField(tinfo, "Info: ", 3)); tcli = new JTextField(); p72.add(addField(tcli, "Cli: ", 4)); p7.add(p71); p7.add(p72); libpath = new JTextField(); addPanel("Library path", "Secondary user library path", libpath, RunnerRepository.REMOTELIBRARY, 229, true, null); JPanel p8 = new JPanel(); p8.setBackground(Color.WHITE); TitledBorder border8 = BorderFactory.createTitledBorder("File"); border8.setTitleFont(new Font("Arial", Font.PLAIN, 14)); border8.setBorder(BorderFactory.createLineBorder(new Color(150, 150, 150), 1)); p8.setBorder(border8); p8.setLayout(null); p8.setBounds(80, 1076, 800, 50); if (PermissionValidator.canChangeFWM()) { paths.add(p8); } JButton save = new JButton("Save"); save.setToolTipText("Save and automatically load config"); save.setBounds(490, 20, 70, 20); save.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ev) { saveXML(false, "fwmconfig"); loadConfig("fwmconfig.xml"); } }); p8.add(save); // if(!PermissionValidator.canChangeFWM()){ // save.setEnabled(false); // } JButton saveas = new JButton("Save as"); saveas.setBounds(570, 20, 90, 20); saveas.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ev) { String filename = CustomDialog.showInputDialog(JOptionPane.QUESTION_MESSAGE, JOptionPane.OK_CANCEL_OPTION, ConfigFiles.this, "File Name", "Please enter file name"); if (!filename.equals("NULL")) { saveXML(false, filename); } } }); p8.add(saveas); final JButton loadXML = new JButton("Load Config"); loadXML.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ev) { try { String[] configs = RunnerRepository .getRemoteFolderContent(RunnerRepository.USERHOME + "/twister/config/"); JComboBox combo = new JComboBox(configs); int resp = (Integer) CustomDialog.showDialog(combo, JOptionPane.INFORMATION_MESSAGE, JOptionPane.OK_CANCEL_OPTION, ConfigFiles.this, "Config", null); final String config; if (resp == JOptionPane.OK_OPTION) config = combo.getSelectedItem().toString(); else config = null; if (config != null) { new Thread() { public void run() { setEnabledTabs(false); JFrame progress = new JFrame(); progress.setAlwaysOnTop(true); progress.setLocation((int) loadXML.getLocationOnScreen().getX(), (int) loadXML.getLocationOnScreen().getY()); progress.setUndecorated(true); JProgressBar bar = new JProgressBar(); bar.setIndeterminate(true); progress.add(bar); progress.pack(); progress.setVisible(true); loadConfig(config); progress.dispose(); setEnabledTabs(true); } }.start(); } } catch (Exception e) { e.printStackTrace(); } } }); loadXML.setBounds(670, 20, 120, 20); p8.add(loadXML); // if(!PermissionValidator.canChangeFWM()){ // loadXML.setEnabled(false); // } tdbfile = new JTextField(); addPanel("Database XML path", "File location for database configuration", tdbfile, RunnerRepository.REMOTEDATABASECONFIGPATH + RunnerRepository.REMOTEDATABASECONFIGFILE, 375, true, null); temailfile = new JTextField(); // emailpanel = (JPanel) addPanel("Email XML path", "File location for email configuration", temailfile, RunnerRepository.REMOTEEMAILCONFIGPATH + RunnerRepository.REMOTEEMAILCONFIGFILE, 448, true, null) .getParent(); //paths.remove(emailpanel); // emailpanel.setBounds(360,440,350,100); // RunnerRepository.window.mainpanel.p4.getEmails().add(emailpanel); tglobalsfile = new JTextField(); addPanel("Globals XML file", "File location for globals parameters", tglobalsfile, RunnerRepository.GLOBALSREMOTEFILE, 521, true, null); tceport = new JTextField(); addPanel("Central Engine Port", "Central Engine port", tceport, RunnerRepository.getCentralEnginePort(), 1003, false, null); // traPort = new JTextField(); // addPanel("Resource Allocator Port","Resource Allocator Port", // traPort,RunnerRepository.getResourceAllocatorPort(),808,false,null); // thttpPort = new JTextField(); // addPanel("HTTP Server Port","HTTP Server Port",thttpPort, // RunnerRepository.getHTTPServerPort(),740,false,null); //paths.add(loadXML); if (!PermissionValidator.canChangeFWM()) { ttcpath.setEnabled(false); tMasterXML.setEnabled(false); tUsers.setEnabled(false); tepid.setEnabled(false); tSuites.setEnabled(false); tlog.setEnabled(false); trunning.setEnabled(false); tdebug.setEnabled(false); tsummary.setEnabled(false); tinfo.setEnabled(false); tcli.setEnabled(false); tdbfile.setEnabled(false); temailfile.setEnabled(false); tceport.setEnabled(false); libpath.setEnabled(false); tsecondarylog.setEnabled(false); testconfigpath.setEnabled(false); tglobalsfile.setEnabled(false); logsenabled.setEnabled(false); } }
From source file:lol.search.RankedStatsPage.java
private JPanel bodyPanel(JPanel body) { body.setLayout(new BoxLayout(body, BoxLayout.X_AXIS)); body.setBackground(backgroundColor); body.setPreferredSize(new Dimension(1200, 530)); //load art // w w w .j a v a2s . co m this.loadArtLabel.setAlignmentX(Component.LEFT_ALIGNMENT); this.loadArtLabel.setPreferredSize(new Dimension(290, 504)); this.loadArtLabel.setIcon(OBJ_GAME_STATIC_DATA.initLoadingArt(champKeyList.get(0))); body.add(this.loadArtLabel); JPanel rightPanel = new JPanel(new FlowLayout()); rightPanel.setPreferredSize(new Dimension(800, 514)); rightPanel.setOpaque(false); //rightPanel.setBorder(BorderFactory.createLineBorder(Color.DARK_GRAY)); JPanel headerPanel = new JPanel(); headerPanel.setLayout(new BoxLayout(headerPanel, BoxLayout.X_AXIS)); headerPanel.setPreferredSize(new Dimension(910, 55)); headerPanel.setOpaque(false); //headerPanel.setBorder(BorderFactory.createLineBorder(Color.DARK_GRAY)); this.defaultHeader.setFont(new Font("Sen-Regular", Font.CENTER_BASELINE, 40)); //custom font this.defaultHeader.setForeground(Color.WHITE); this.defaultHeader.setAlignmentX(Component.LEFT_ALIGNMENT); this.defaultHeader.setText(" Season Totals: "); this.nameHeader.setFont(new Font("Sen-Regular", Font.CENTER_BASELINE, 40)); //custom font this.nameHeader.setForeground(valueOrange); this.nameHeader.setAlignmentX(Component.LEFT_ALIGNMENT); this.nameHeader.setText("Overall"); this.titleHeader.setFont(new Font("Sen-Regular", Font.CENTER_BASELINE, 16)); //custom font this.titleHeader.setForeground(new Color(255, 128, 0)); this.titleHeader.setAlignmentX(Component.LEFT_ALIGNMENT); //nameHeader.setAlignmentY(Component.TOP_ALIGNMENT); titleHeader.setAlignmentY(Component.TOP_ALIGNMENT); headerPanel.add(defaultHeader); headerPanel.add(nameHeader); headerPanel.add(titleHeader); rightPanel.add(headerPanel); rightPanel.add(statsPanel()); body.add(rightPanel); return body; }