List of usage examples for javax.swing JPanel setPreferredSize
@BeanProperty(preferred = true, description = "The preferred size of the component.") public void setPreferredSize(Dimension preferredSize)
From source file:com.polivoto.vistas.Charts.java
public void getBotonesPreguntas(JPanel botones) { GridBagConstraints gridBagConstraints; boolean first = false; botones.removeAll();/*from www. j a v a2s . c o m*/ JPanel panelRelleno = new JPanel(new BorderLayout(20, 20)); panelRelleno.setBackground(Color.white); JPanel panelContainer = new JPanel(new GridLayout(0, 1, 30, 30)); panelContainer.setBackground(Color.white); botones.setPreferredSize(new Dimension(250, 0)); botones.setLayout(new GridBagLayout()); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.fill = GridBagConstraints.BOTH; gridBagConstraints.weightx = 0.1; gridBagConstraints.weighty = 0.1; gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5); botones.add(panelContainer, gridBagConstraints); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.fill = GridBagConstraints.BOTH; gridBagConstraints.weightx = 0.1; gridBagConstraints.weighty = 0.9; gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5); botones.add(panelRelleno, gridBagConstraints); JLabel labelPreguntas = new JLabel("PREGUNTAS"); labelPreguntas.setFont(new Font("Roboto", 1, 24)); labelPreguntas.setHorizontalAlignment(0); labelPreguntas.setForeground(new Color(137, 36, 31)); panelContainer.add(labelPreguntas); for (Pregunta pregunta : votacion.getPreguntas()) { Boton boton = new Boton("<html><div align=center>" + pregunta.getTitulo() + "</html>") { @Override public void botonClicked(Boton e) { crearGrafica(pregunta); botonActual = e; } }; boton.setPreferredSize(new Dimension(200, 0)); panelContainer.add(boton); if (!first) { botonActual = boton; first = true; } } botones.repaint(); botones.revalidate(); }
From source file:ac.openmicrolabs.view.gui.OMLLoggerView.java
private JPanel createContentPane(final TimeSeriesCollection t, final String graphTitle, final double graphTimeRange, final String[] signals) { btmPanel.remove(reportButton);/* w w w . j ava2 s . co m*/ chanLabel = new JLabel[signals.length]; int activeSignalCount = 0; for (int i = 0; i < signals.length; i++) { chanLabel[i] = new JLabel(h.format("label", (char) ((i / PIN_COUNT) + ASCII_OFFSET) + "-0x" + String.format("%02x", (i % PIN_COUNT) + SLAVE_BITS).toUpperCase())); chanLabel[i].setHorizontalAlignment(JLabel.CENTER); if (signals[i] != null) { activeSignalCount++; } else { chanLabel[i].setEnabled(false); } } typeLabel = new JLabel[activeSignalCount]; valLabel = new JLabel[activeSignalCount]; minLabel = new JLabel[activeSignalCount]; maxLabel = new JLabel[activeSignalCount]; avgLabel = new JLabel[activeSignalCount]; int index = 0; for (int i = 0; i < signals.length; i++) { if (signals[i] != null) { typeLabel[index] = new JLabel(h.format("body", signals[i])); typeLabel[index].setHorizontalAlignment(JLabel.CENTER); index++; } } for (int i = 0; i < activeSignalCount; i++) { valLabel[i] = new JLabel(); valLabel[i].setHorizontalAlignment(JLabel.CENTER); minLabel[i] = new JLabel(); minLabel[i].setHorizontalAlignment(JLabel.CENTER); maxLabel[i] = new JLabel(); maxLabel[i].setHorizontalAlignment(JLabel.CENTER); avgLabel[i] = new JLabel(); avgLabel[i].setHorizontalAlignment(JLabel.CENTER); } // Set up main panel. JPanel mainPanel = new JPanel(); mainPanel.setLayout(null); mainPanel.setBackground(Color.white); // Create graph. snsChart = ChartFactory.createTimeSeriesChart(graphTitle, GRAPH_X_LABEL, GRAPH_Y_LABEL, t, true, true, false); final XYPlot plot = snsChart.getXYPlot(); ValueAxis axis = plot.getDomainAxis(); axis.setAutoRange(true); axis.setFixedAutoRange(graphTimeRange); axis = plot.getRangeAxis(); axis.setRange(graphMinY, graphMaxY); ChartPanel snsChartPanel = new ChartPanel(snsChart); snsChartPanel.setPreferredSize(new Dimension(FRAME_WIDTH - PAD20, GRAPH_HEIGHT - PAD10)); // Set up graph panel. final JPanel graphPanel = new JPanel(); graphPanel.setSize(FRAME_WIDTH - PAD20, GRAPH_HEIGHT); graphPanel.setLocation(0, 0); graphPanel.setBackground(Color.white); graphPanel.add(snsChartPanel); // Set up results panel. final JPanel resultsPanel = createResultsPane(); // Set up scroll pane. final JScrollPane scrollPane = new JScrollPane(resultsPanel); scrollPane.setSize(FRAME_WIDTH - PAD20, FRAME_HEIGHT - BTM_HEIGHT - GRAPH_HEIGHT + PAD8); scrollPane.setLocation(PAD5, GRAPH_HEIGHT); scrollPane.setBackground(Color.white); scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER); // Set results panel size. resultsPanel.setPreferredSize(new Dimension(PAD40 + (signals.length * RESULTS_COL_WIDTH), FRAME_HEIGHT - BTM_HEIGHT - GRAPH_HEIGHT - PAD120)); resultsPanel.revalidate(); // Set up bottom panel. btmPanel.setLayout(null); btmPanel.setSize(FRAME_WIDTH, BTM_HEIGHT); btmPanel.setLocation(0, this.getHeight() - BTM_HEIGHT); btmPanel.setBackground(Color.white); // Instantiate bottom panel objects. footerLabel.setSize(LABEL_WIDTH, LABEL_HEIGHT); footerLabel.setLocation(LABEL_X, LABEL_Y); footerLabel.setText(""); doneButton.setIcon(new ImageIcon("img/22x22/stop.png")); doneButton.setSize(DONE_WIDTH, DONE_HEIGHT); doneButton.setLocation(FRAME_WIDTH - PAD20 - doneButton.getWidth(), PAD15); progressBar = new JProgressBar(); progressBar.setSize(FRAME_WIDTH - PAD40 - doneButton.getWidth() - footerLabel.getWidth(), PAD20); progressBar.setValue(0); progressBar.setLocation(footerLabel.getWidth() + PAD10, PAD22); // Populate bottom panel. btmPanel.add(footerLabel); btmPanel.add(progressBar); btmPanel.add(doneButton); // Populate main panel. mainPanel.add(graphPanel); mainPanel.add(scrollPane); mainPanel.add(btmPanel); return mainPanel; }
From source file:lol.search.RankedStatsPage.java
private JPanel headerPanel() { //init spacers for header for (int i = 0; i < 10; i++) { JLabel label = new JLabel("--"); label.setForeground(new Color(0, 0, 0, 0)); spacers.add(label);//from w w w . j a v a 2 s . com } //header -- to set this semi-transparent i had to remove setOpaque and replace with setBackground(...) JPanel headerPanel = new JPanel(); headerPanel.setLayout(new BorderLayout()); //headerPanel.setBorder(BorderFactory.createLineBorder(Color.WHITE)); headerPanel.setBackground(backgroundColor); headerPanel.setPreferredSize(headerDimension); //back button JPanel buttonHolder = new JPanel(); ImageIcon buttonImage = new ImageIcon("assets\\other\\button.png"); ImageIcon buttonPressedImage = new ImageIcon("assets\\other\\buttonPressed.png"); Image tempImage = buttonImage.getImage(); Image newTempImg = tempImage.getScaledInstance(75, 35, Image.SCALE_SMOOTH); buttonImage = new ImageIcon(newTempImg); JButton backButton = new JButton("BACK"); backButton.setFont(new Font("Sen-Regular", Font.CENTER_BASELINE, 10)); //custom font backButton.setForeground(Color.WHITE); //text color backButton.setBackground(new Color(0, 0, 0, 0)); backButton.setBorder(BorderFactory.createLineBorder(Color.BLACK)); backButton.setHorizontalTextPosition(AbstractButton.CENTER); backButton.setPreferredSize(new Dimension(75, 35)); //pressed button Image tempImage2 = buttonPressedImage.getImage(); Image newTempImg2 = tempImage2.getScaledInstance(75, 35, Image.SCALE_SMOOTH); buttonPressedImage = new ImageIcon(newTempImg2); backButton.setIcon(buttonImage); backButton.setRolloverIcon(buttonPressedImage); backButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { //button pressed System.out.println("Going back...\n"); masterFrame.getContentPane().removeAll(); masterFrame.revalidate(); masterFrame.repaint(); MainPage MAIN_PAGE = new MainPage(masterFrame, summonerName); } }); buttonHolder.add(backButton); buttonHolder.setOpaque(false); headerPanel.add(buttonHolder, BorderLayout.LINE_START); //centerpanel JPanel centerPanel = new JPanel(); centerPanel.setLayout(new GridLayout(1, 2)); centerPanel.setOpaque(false); //centerPanel.setBorder(BorderFactory.createLineBorder(Color.WHITE)); //rightcenter JPanel rightCenter = new JPanel(); rightCenter.setOpaque(false); rightCenter.setLayout(new GridLayout(2, 1)); //top center panel JPanel topCenter = new JPanel(); topCenter.setOpaque(false); topCenter.setLayout(new BoxLayout(topCenter, BoxLayout.X_AXIS)); //profile icon JPanel proIconPanel = new JPanel(); proIconPanel.setOpaque(false); proIconPanel.setLayout(new BoxLayout(proIconPanel, BoxLayout.Y_AXIS)); JLabel profileIconLabel = new JLabel(this.profileIcon); //profileIconLabel.setBorder(BorderFactory.createLineBorder(Color.WHITE)); profileIconLabel.setAlignmentX(Component.RIGHT_ALIGNMENT); proIconPanel.add(profileIconLabel); centerPanel.add(proIconPanel); //empty spacer topCenter.add(spacers.get(0)); //summoner name JLabel summonerNameLabel = new JLabel(this.summonerName); summonerNameLabel.setFont(new Font("Sen-Regular", Font.CENTER_BASELINE, 15)); //custom font summonerNameLabel.setForeground(Color.WHITE); //text color summonerNameLabel.setAlignmentX(Component.LEFT_ALIGNMENT); topCenter.add(summonerNameLabel); //empty spacer topCenter.add(spacers.get(1)); //tier JLabel tierLabel = new JLabel(this.tier); tierLabel.setFont(new Font("Sen-Regular", Font.CENTER_BASELINE, 13)); //custom font tierLabel.setForeground(new Color(219, 219, 219)); //text color tierLabel.setAlignmentX(Component.LEFT_ALIGNMENT); topCenter.add(tierLabel); //empty spacer topCenter.add(spacers.get(2)); //division JLabel divisionLabel = new JLabel(this.division); divisionLabel.setFont(new Font("Sen-Regular", Font.CENTER_BASELINE, 13)); //custom font divisionLabel.setForeground(new Color(219, 219, 219)); //text color divisionLabel.setAlignmentX(Component.LEFT_ALIGNMENT); topCenter.add(divisionLabel); //bottom center panel JPanel bottomCenter = new JPanel(); bottomCenter.setOpaque(false); bottomCenter.setLayout(new BoxLayout(bottomCenter, BoxLayout.X_AXIS)); //empty spacer bottomCenter.add(spacers.get(3)); //season JLabel winsLabel = new JLabel(this.season); winsLabel.setFont(new Font("Sen-Regular", Font.CENTER_BASELINE, 14)); //custom font winsLabel.setForeground(new Color(219, 219, 219)); //text color winsLabel.setAlignmentX(Component.LEFT_ALIGNMENT); bottomCenter.add(winsLabel); rightCenter.add(topCenter); rightCenter.add(bottomCenter); centerPanel.add(rightCenter); headerPanel.add(centerPanel, BorderLayout.CENTER); //empty panel to balance right side JPanel ee = new JPanel(); ee.setOpaque(false); ee.setPreferredSize(new Dimension(260, 50)); headerPanel.add(ee, BorderLayout.LINE_END); return headerPanel; }
From source file:gda.gui.BatonPanel.java
/** * Constructor/*from w w w .java 2 s . c o m*/ */ public BatonPanel() { super(); if (LocalProperties.isBatonManagementEnabled()) { initGUI(); } else { JPanel jPanel1 = new JPanel(); jPanel1.setLayout(new FlowLayout()); jPanel1.setPreferredSize(new java.awt.Dimension(500, 200)); lblUser = new JLabel(); lblUser.setBounds(15, 36, 422, 14); lblUser.setHorizontalAlignment(SwingConstants.CENTER); lblUser.setHorizontalTextPosition(SwingConstants.CENTER); lblUser.setText("Please close this panel: it is for baton control and this is not currently in use."); this.add(jPanel1); jPanel1.add(lblUser); } setLabel("Baton Panel"); }
From source file:net.sf.taverna.t2.activities.wsdlsir.views.WSDLActivityConfigurationView.java
private void initComponents() { this.setModalityType(Dialog.ModalityType.DOCUMENT_MODAL); int gridy = 0; // title panel JPanel titlePanel = new JPanel(new BorderLayout()); titlePanel.setBackground(Color.WHITE); JLabel titleLabel = new JLabel("Security configuration"); titleLabel.setFont(titleLabel.getFont().deriveFont(Font.BOLD, 13.5f)); titleLabel.setBorder(new EmptyBorder(10, 10, 0, 10)); DialogTextArea titleMessage = new DialogTextArea("Select a security profile for the service"); titleMessage.setMargin(new Insets(5, 20, 10, 10)); titleMessage.setFont(titleMessage.getFont().deriveFont(11f)); titleMessage.setEditable(false);/*from w w w .j a v a 2 s. c om*/ titleMessage.setFocusable(false); titlePanel.setBorder(new EmptyBorder(10, 10, 0, 10)); titlePanel.add(titleLabel, BorderLayout.NORTH); titlePanel.add(titleMessage, BorderLayout.CENTER); addDivider(titlePanel, SwingConstants.BOTTOM, true); // Main panel JPanel mainPanel = new JPanel(); mainPanel.setLayout(new GridBagLayout()); mainPanel.setBorder(new EmptyBorder(10, 10, 10, 10)); //Create the radio buttons noSecurityRadioButton = new JRadioButton("None"); noSecurityRadioButton.addItemListener(this); wsSecurityAuthNRadioButton = new JRadioButton("WS-Security username and password authentication"); wsSecurityAuthNRadioButton.addItemListener(this); httpSecurityAuthNRadioButton = new JRadioButton("HTTP username and password authentication"); httpSecurityAuthNRadioButton.addItemListener(this); SAMLSecurityAuthNRadioButton = new JRadioButton("SAML WEB SSO profile authentication"); SAMLSecurityAuthNRadioButton.addItemListener(this); //Group the radio buttons buttonGroup = new ButtonGroup(); buttonGroup.add(noSecurityRadioButton); buttonGroup.add(wsSecurityAuthNRadioButton); buttonGroup.add(httpSecurityAuthNRadioButton); buttonGroup.add(SAMLSecurityAuthNRadioButton); GridBagConstraints gbc = new GridBagConstraints(); gbc.weightx = 1.0; gbc.weighty = 0.0; gbc.gridx = 0; gbc.gridy = gridy++; gbc.fill = GridBagConstraints.NONE; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 10, 0, 0); mainPanel.add(noSecurityRadioButton, gbc); noSecurityLabel = new JLabel("Service requires no security"); noSecurityLabel.setFont(noSecurityLabel.getFont().deriveFont(11f)); // addDivider(noSecurityLabel, SwingConstants.BOTTOM, false); gbc.gridx = 0; gbc.gridy = gridy++; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(0, 40, 10, 10); mainPanel.add(noSecurityLabel, gbc); gbc.gridx = 0; gbc.gridy = gridy++; gbc.fill = GridBagConstraints.NONE; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 10, 0, 0); mainPanel.add(httpSecurityAuthNRadioButton, gbc); ActionListener usernamePasswordListener = new ActionListener() { public void actionPerformed(ActionEvent e) { // Get Credential Manager UI to get the username and password for the service CredentialManagerUI credManagerUI = CredentialManagerUI.getInstance(); if (credManagerUI != null) credManagerUI.newPasswordForService(oldBean.getWsdl()); } }; httpSecurityAuthNLabel = new JLabel( "Service requires HTTP username and password in order to authenticate the user"); httpSecurityAuthNLabel.setFont(httpSecurityAuthNLabel.getFont().deriveFont(11f)); gbc.gridx = 0; gbc.gridy = gridy++; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(0, 40, 10, 10); mainPanel.add(httpSecurityAuthNLabel, gbc); // Set username and password button; setHttpUsernamePasswordButton = new JButton("Set username and password"); gbc.gridx = 0; gbc.gridy = gridy++; gbc.fill = GridBagConstraints.NONE; gbc.anchor = GridBagConstraints.EAST; gbc.insets = new Insets(0, 40, 10, 10); gbc.weightx = 1.0; gbc.weighty = 1.0; // add any vertical space to this component mainPanel.add(setHttpUsernamePasswordButton, gbc); setHttpUsernamePasswordButton.addActionListener(usernamePasswordListener); /////SAML gbc.gridx = 0; gbc.gridy = gridy++; gbc.fill = GridBagConstraints.NONE; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 10, 0, 0); mainPanel.add(SAMLSecurityAuthNRadioButton, gbc); ActionListener getCookieListener = new ActionListener() { /** * This listener will use the CallPreparator to obtain the cookies (included shibsession_XXX cookie) and * save it in the Credential Manager (as the password for user "nomatter") */ public void actionPerformed(ActionEvent e) { try { WSDLParser parser = new WSDLParser(newBean.getWsdl()); List<String> endpoints = parser.getOperationEndpointLocations(newBean.getOperation()); for (String endpoint : endpoints) //Actually i am only expecting one endpoint { if (debug) System.out .println("Obtaining a SAML cookies to save in credential manager:" + endpoint); Cookie[] cookies = CallPreparator.createCookieForCallToEndpoint(endpoint); // Uncomment for just the shibsession cookie // Cookie[] cookiessession = new Cookie[1]; // for (Cookie cook : cookies) // if (cook.getName().contains("shibsession")) // cookiessession[0]=cook; // cookies=cookiessession; CredentialManager credman = CredentialManager.getInstance(); credman.saveUsernameAndPasswordForService( new UsernamePassword("nomatter", serializetoString(cookies)), new URI(endpoint)); } } catch (WSDLException ex) { System.err.println( "Problem getting or saving SAML cookie: " + newBean.getWsdl() + ". " + ex.getMessage()); ex.printStackTrace(); } catch (ParserConfigurationException ex) { System.err.println( "Problem getting or saving SAML cookie: " + newBean.getWsdl() + ". " + ex.getMessage()); ex.printStackTrace(); } catch (Exception ex) { System.err.println( "Problem getting or saving SAML cookie: " + newBean.getWsdl() + ". " + ex.getMessage()); ex.printStackTrace(); } } }; SAMLSecurityAuthNLabel = new JLabel("<html>" + "Service requires SAML Web SSO profile to be perfomed in order to authenticate the user. " + "A cookie will be saved in your Credential Manger. " + "In the case that it stops working, please delete the entry in your Credential Manager or re-authenticate" + "</html>"); SAMLSecurityAuthNLabel.setFont(SAMLSecurityAuthNLabel.getFont().deriveFont(11f)); gbc.gridx = 0; gbc.gridy = gridy++; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(3, 40, 10, 10); mainPanel.add(SAMLSecurityAuthNLabel, gbc); // Set username and password button; setSAMLGETCookieButton = new JButton("Authenticate and save Authentication data in Credential Manger"); gbc.gridx = 0; gbc.gridy = gridy++; gbc.fill = GridBagConstraints.NONE; gbc.anchor = GridBagConstraints.EAST; gbc.insets = new Insets(0, 40, 10, 10); gbc.weightx = 1.0; gbc.weighty = 1.0; // add any vertical space to this component mainPanel.add(setSAMLGETCookieButton, gbc); setSAMLGETCookieButton.addActionListener(getCookieListener); //END SAML gbc.gridx = 0; gbc.gridy = gridy++; gbc.fill = GridBagConstraints.NONE; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 10, 0, 0); mainPanel.add(wsSecurityAuthNRadioButton, gbc); wsSecurityAuthNLabel = new JLabel( "Service requires WS-Security username and password in order to authenticate the user"); wsSecurityAuthNLabel.setFont(wsSecurityAuthNLabel.getFont().deriveFont(11f)); gbc.gridx = 0; gbc.gridy = gridy++; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(0, 40, 0, 0); mainPanel.add(wsSecurityAuthNLabel, gbc); // Password type list passwordTypeComboBox = new JComboBox(passwordTypes); passwordTypeComboBox.setRenderer(new ComboBoxTooltipRenderer()); gbc.gridx = 0; gbc.gridy = gridy++; gbc.fill = GridBagConstraints.NONE; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(10, 40, 0, 0); mainPanel.add(passwordTypeComboBox, gbc); // 'Add timestamp' checkbox addTimestampCheckBox = new JCheckBox("Add a timestamp to SOAP message"); gbc.gridx = 0; gbc.gridy = gridy++; gbc.fill = GridBagConstraints.NONE; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 40, 10, 10); mainPanel.add(addTimestampCheckBox, gbc); // Set username and password button; setWsdlUsernamePasswordButton = new JButton("Set username and password"); gbc.gridx = 0; gbc.gridy = gridy++; gbc.fill = GridBagConstraints.NONE; gbc.anchor = GridBagConstraints.EAST; gbc.insets = new Insets(0, 40, 10, 10); gbc.weightx = 1.0; gbc.weighty = 1.0; // add any vertical space to this component mainPanel.add(setWsdlUsernamePasswordButton, gbc); setWsdlUsernamePasswordButton.addActionListener(usernamePasswordListener); addDivider(mainPanel, SwingConstants.BOTTOM, true); // OK/Cancel button panel JPanel okCancelPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); JButton okButton = new JButton("OK"); okButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { okPressed(); } }); JButton cancelButton = new JButton("Cancel"); cancelButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { cancelPressed(); } }); okCancelPanel.add(cancelButton); okCancelPanel.add(okButton); // Enable/disable controls based on what is the current security profiles String securityProfile = oldBean.getSecurityProfile(); if (securityProfile == null) { noSecurityRadioButton.setSelected(true); } else { if (securityProfile.equals(SecurityProfiles.WSSECURITY_USERNAMETOKEN_PLAINTEXTPASSWORD) || securityProfile.equals(SecurityProfiles.WSSECURITY_USERNAMETOKEN_DIGESTPASSWORD) || securityProfile.equals(SecurityProfiles.WSSECURITY_TIMESTAMP_USERNAMETOKEN_PLAINTEXTPASSWORD) || securityProfile.equals(SecurityProfiles.WSSECURITY_TIMESTAMP_USERNAMETOKEN_DIGESTPASSWORD)) { wsSecurityAuthNRadioButton.setSelected(true); } if (securityProfile.equals(SecurityProfiles.HTTP_BASIC_AUTHN) || securityProfile.equals(SecurityProfiles.HTTP_DIGEST_AUTHN)) { httpSecurityAuthNRadioButton.setSelected(true); } if (securityProfile.equals(SecurityProfiles.SAMLWEBSSOAUTH)) { SAMLSecurityAuthNRadioButton.setSelected(true); } if (securityProfile.equals(SecurityProfiles.WSSECURITY_USERNAMETOKEN_PLAINTEXTPASSWORD) || securityProfile .equals(SecurityProfiles.WSSECURITY_TIMESTAMP_USERNAMETOKEN_PLAINTEXTPASSWORD)) { passwordTypeComboBox.setSelectedItem(PLAINTEXT_PASSWORD); } else if (securityProfile.equals(SecurityProfiles.WSSECURITY_USERNAMETOKEN_DIGESTPASSWORD) || securityProfile.equals(SecurityProfiles.WSSECURITY_TIMESTAMP_USERNAMETOKEN_DIGESTPASSWORD)) { passwordTypeComboBox.setSelectedItem(DIGEST_PASSWORD); } if (securityProfile.equals(SecurityProfiles.WSSECURITY_TIMESTAMP_USERNAMETOKEN_DIGESTPASSWORD) || securityProfile .equals(SecurityProfiles.WSSECURITY_TIMESTAMP_USERNAMETOKEN_PLAINTEXTPASSWORD)) { addTimestampCheckBox.setSelected(true); } else { addTimestampCheckBox.setSelected(false); } } // Put everything together JPanel layoutPanel = new JPanel(new BorderLayout()); layoutPanel.add(titlePanel, BorderLayout.NORTH); layoutPanel.add(mainPanel, BorderLayout.CENTER); layoutPanel.add(okCancelPanel, BorderLayout.SOUTH); layoutPanel.setPreferredSize(new Dimension(550, 490)); this.getContentPane().add(layoutPanel); this.pack(); }
From source file:es.emergya.ui.plugins.admin.aux1.SummaryAction.java
private JPanel getBotonesSalir(final SaveOrUpdateAction guardar, final JFrame d, int width) { JPanel botones = new JPanel(new FlowLayout(FlowLayout.TRAILING)); botones.setPreferredSize(new Dimension(width, 40)); botones.setOpaque(false);//from w w w .ja v a 2s. c o m botones.add(getGuardarBtn(guardar)); botones.add(getCancelBtn(d)); return botones; }
From source file:UI.SecurityDashboard.java
private void performMetric4(MainViewPanel mvp) { Metric4 metric4 = new Metric4(); JPanel graphPanel4 = new JPanel(); graphPanel4.setLayout(new BorderLayout()); metric4.run();//from w w w. j a v a 2 s . c o m graphPanel4.add(mvp.getPanel4(metric4), BorderLayout.CENTER); MalwarePanel.setLayout(new BorderLayout()); JTextArea header = new JTextArea( "\nThe Malware detection will scan for viruses, trojans, and worms that may have affected a device.\n"); header.setLineWrap(true); header.setWrapStyleWord(true); header.setEditable(false); MalwarePanel.add(header, BorderLayout.NORTH); if (metric4.getTotalCount() == 0) { Font noMalwareFont = new Font("Calibri", Font.BOLD, 40); JLabel noMalwareLabel = new JLabel( " No Malware Detected"); noMalwareLabel.setFont(noMalwareFont); noMalwareLabel.setPreferredSize(new Dimension(WIDTH, 100)); graphPanel4.add(noMalwareLabel, BorderLayout.NORTH); JPanel emptyPanel = new JPanel(); emptyPanel.setPreferredSize(new Dimension(50, 200)); emptyPanel.setOpaque(true); graphPanel4.add(emptyPanel, BorderLayout.SOUTH); } MalwarePanel.add(graphPanel4, BorderLayout.CENTER); ChartPanel fourthPanel = mvp.getPanel4(metric4); fourthPanel.addChartMouseListener(new ChartMouseListener() { @Override public void chartMouseClicked(ChartMouseEvent cme) { dashboardTabs.setSelectedIndex(4); } @Override public void chartMouseMoved(ChartMouseEvent cme) { } }); Metric4Panel.setLayout(new BorderLayout()); Font titleFont = new Font("Calibri", Font.BOLD, 27); JLabel malwareTitleLabel = new JLabel(" Malware Detection"); malwareTitleLabel.setFont(titleFont); Metric4Panel.add(malwareTitleLabel, BorderLayout.PAGE_START); Metric4Panel.add(fourthPanel, BorderLayout.CENTER); if (metric4.getTotalCount() == 0) { Font noMalwareFont = new Font("Calibri", Font.BOLD, 20); JLabel noMalwareLabel = new JLabel(" No Malware Detected"); noMalwareLabel.setFont(noMalwareFont); Metric4Panel.add(noMalwareLabel, BorderLayout.SOUTH); } Metric4Panel.setBackground(Color.white); }
From source file:es.emergya.ui.plugins.admin.aux1.SummaryAction.java
private JPanel buildBotones(final Dimension dimension2, final JList left, final JList right) { JPanel botones = new JPanel(new GridBagLayout()); botones.setPreferredSize(dimension2); JButton derecha = new JButton(LogicConstants.getIcon("button_right")); derecha.setBorderPainted(false);/*from ww w .j a v a 2s .c om*/ derecha.setOpaque(false); derecha.setContentAreaFilled(false); derecha.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { cambios = true; for (Object o : left.getSelectedValues()) { ((DefaultListModel) right.getModel()).addElement(o); rightItems.add(o); } for (Object o : left.getSelectedValues()) { ((DefaultListModel) left.getModel()).removeElement(o); leftItems.remove(o); } } }); GridBagConstraints gbc = new GridBagConstraints(); gbc.gridy = 0; botones.add(derecha, gbc); izquierda.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { cambios = true; for (Object o : right.getSelectedValues()) { ((DefaultListModel) left.getModel()).addElement(o); leftItems.add(o); } for (Object o : right.getSelectedValues()) { ((DefaultListModel) right.getModel()).removeElement(o); rightItems.remove(o); } } }); gbc.gridy++; izquierda.setBorderPainted(false); izquierda.setOpaque(false); izquierda.setContentAreaFilled(false); botones.add(izquierda, gbc); botones.setOpaque(false); return botones; }
From source file:br.org.acessobrasil.ases.ferramentas_de_reparo.vista.imagem.PanelDescricaoImagens.java
private void initComponentsEscalavel(ArrayList<FerramentaDescricaoModel> erros) { Ferramenta_Imagens.carregaTexto(TokenLang.LANG); JPanel regraFonteBtn = new JPanel(); regraFonteBtn.setLayout(new BorderLayout()); textAreaSourceCode = new G_TextAreaSourceCode(); textAreaSourceCode.setTipoHTML();//from w ww. ja va 2s . c o m new OnChange(textAreaSourceCode, this); // parentFrame.setTitle("Associador de rtulos"); tableLinCod = new TabelaDescricao(this, erros); arTextPainelCorrecao = new ArTextPainelCorrecao(this); // scrollPaneCorrecaoLabel = new ConteudoCorrecaoLabel(); analiseSistematica = new JButton(); salvar = new JButton(); abrir = new JButton(); cancelar = new JButton(); strConteudoalt = new String(); // panelLegenda = new JPanel(); btnSalvar = new JMenuItem(GERAL.BTN_SALVAR); pnRegra = new JPanel(); lbRegras1 = new JLabel(); lbRegras2 = new JLabel(); pnSetaDescricao = new JPanel(); spTextoDescricao = new JScrollPane(); tArParticipRotulo = new TArParticipRotulo(this); conteudoDoAlt = new JTextArea(); pnListaErros = new JPanel(); scrollPanetabLinCod = new JScrollPane(); /** * Mostra pro usurio a imagem que est sem descrio */ imagemSemDesc = new XHTMLPanel(); pnBotoes = new JPanel(); salvar.setEnabled(false); salvaAlteracoes = TxtBuffer.getInstanciaSalvaAlteracoes(textAreaSourceCode.getTextPane(), salvar, new JMenuItem(), parentFrame); adicionar = new JButton(); aplicar = new JButton(); conteudoParticRotulo = new ArrayList<String>(); analiseSistematica.setEnabled(false); // setJMenuBar(this.criaMenuBar()); // ======== this ======== // setTitle("Associe explicitamente os r\u00f3tulos aos respectivos // controles:"); setBackground(CoresDefault.getCorPaineis()); Container contentPane = this;// ?? contentPane.setLayout(new GridLayout(2, 1)); // ======== pnRegra ======== { pnRegra.setBorder(criaBorda(Ferramenta_Imagens.TITULO_REGRA)); pnRegra.setLayout(new GridLayout(2, 1)); pnRegra.add(lbRegras1); lbRegras1.setText(Ferramenta_Imagens.REGRAP1); lbRegras2.setText(Ferramenta_Imagens.REGRAP2); lbRegras1.setHorizontalAlignment(SwingConstants.CENTER); lbRegras2.setHorizontalAlignment(SwingConstants.CENTER); pnRegra.add(lbRegras1); pnRegra.add(lbRegras2); pnRegra.setPreferredSize(new Dimension(700, 60)); } // G_URLIcon.setIcon(lbTemp, // "http://pitecos.blogs.sapo.pt/arquivo/pai%20natal%20o5.%20jpg.jpg"); JScrollPane sp = new JScrollPane(); sp.setViewportView(imagemSemDesc); sp.setPreferredSize(new Dimension(500, 300)); // ======== pnDescricao ======== // ---- Salvar ---- salvar.setText(Ferramenta_Imagens.BTN_SALVAR); salvar.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { salvarActionPerformed(e); } }); salvar.setToolTipText(Ferramenta_Imagens.DICA_SALVAR); salvar.getAccessibleContext().setAccessibleDescription(Ferramenta_Imagens.DICA_SALVAR); salvar.getAccessibleContext().setAccessibleName(Ferramenta_Imagens.DICA_SALVAR); salvar.setBounds(10, 0, 150, 25); abrir.setText(Ferramenta_Imagens.BTN_ABRIR); abrir.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AbrirActionPerformed(e); } }); abrir.setToolTipText(Ferramenta_Imagens.DICA_ABRIR_HTML); abrir.getAccessibleContext().setAccessibleDescription(Ferramenta_Imagens.DICA_ABRIR_HTML); abrir.getAccessibleContext().setAccessibleName(Ferramenta_Imagens.DICA_ABRIR_HTML); abrir.setBounds(165, 0, 150, 25); cancelar.setText(Ferramenta_Imagens.TELA_ANTERIOR); cancelar.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { CancelarActionPerformed(e); } }); cancelar.setToolTipText(Ferramenta_Imagens.DICA_TELA_ANTERIOR); cancelar.getAccessibleContext().setAccessibleDescription(Ferramenta_Imagens.DICA_TELA_ANTERIOR); cancelar.getAccessibleContext().setAccessibleName(Ferramenta_Imagens.TELA_ANTERIOR); cancelar.setBounds(320, 0, 150, 25); analiseSistematica.setText(GERAL.ANALISE_SISTEMATICA); analiseSistematica.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { buttonAction = e; Thread t = new Thread(new Runnable() { public void run() { PainelStatusBar.showProgTarReq(); parentFrame.setCursor(new Cursor(Cursor.WAIT_CURSOR)); analiseSistematicaActionPerformed(buttonAction); parentFrame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); PainelStatusBar.hideProgTarReq(); } }); t.setPriority(9); t.start(); } }); analiseSistematica.setToolTipText(GERAL.DICA_ANALISE_SISTEMATICA); analiseSistematica.getAccessibleContext().setAccessibleDescription(GERAL.DICA_ANALISE_SISTEMATICA); analiseSistematica.getAccessibleContext().setAccessibleName(GERAL.DICA_ANALISE_SISTEMATICA); analiseSistematica.setBounds(480, 0, 150, 25); // ======== pnParticRotulo ======== pnSetaDescricao.setBorder(criaBorda(Ferramenta_Imagens.TITULO_DIGITE_O_ALT)); GridBagConstraints cons = new GridBagConstraints(); GridBagLayout layout = new GridBagLayout(); cons.fill = GridBagConstraints.BOTH; cons.weighty = 1; cons.weightx = 0.80; pnSetaDescricao.setLayout(layout); cons.anchor = GridBagConstraints.SOUTHEAST; cons.insets = new Insets(0, 0, 0, 10); conteudoDoAlt.addKeyListener(new KeyListener() { public void keyPressed(KeyEvent arg0) { } public void keyTyped(KeyEvent arg0) { } public void keyReleased(KeyEvent arg0) { if (conteudoDoAlt.getText().length() == 0) { System.out.println("conteudo vazio"); aplicar.setEnabled(false); } else if (tableLinCod.getSelectedRow() != -1) { System.out.println("com conteudo"); aplicar.setEnabled(true); } } }); // ======== spParticRotulo ======== { spTextoDescricao.setViewportView(conteudoDoAlt); } // lbRegras1.setText(Reparo_Imagens.REGRAP2); // lbRegras1.setHorizontalAlignment(SwingConstants.CENTER); // pnRegra.add(lbRegras1); pnSetaDescricao.add(spTextoDescricao, cons); cons.weightx = 0.20; pnSetaDescricao.setPreferredSize(new Dimension(400, 60)); // ======== pnListaErros ======== { pnListaErros.setBorder(criaBorda(Ferramenta_Imagens.LISTA_ERROS)); pnListaErros.setLayout(new BorderLayout()); // ======== scrollPanetabLinCod ======== { scrollPanetabLinCod.setViewportView(tableLinCod); } pnListaErros.add(scrollPanetabLinCod, BorderLayout.CENTER); } // ======== pnBotoes ======== { // pnBotoes.setBorder(criaBorda("")); pnBotoes.setLayout(null); // ---- adicionar ---- adicionar.setText(Ferramenta_Imagens.BTN_ADICIONAR); adicionar.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { adicionarActionPerformed(e); } }); adicionar.setToolTipText(Ferramenta_Imagens.DICA_ADICIONAR); adicionar.getAccessibleContext().setAccessibleDescription(Ferramenta_Imagens.DICA_ADICIONAR); adicionar.getAccessibleContext().setAccessibleName(Ferramenta_Imagens.DICA_ADICIONAR); adicionar.setBounds(10, 5, 150, 25); // pnBotoes.add(adicionar); // ---- aplicarRotulo ---- aplicar.setEnabled(false); aplicar.setText(Ferramenta_Imagens.BTN_APLICAR); aplicar.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { aplicarRotuloActionPerformed(e); } }); aplicar.setToolTipText(Ferramenta_Imagens.DICA_APLICAR); aplicar.getAccessibleContext().setAccessibleDescription(Ferramenta_Imagens.DICA_APLICAR); aplicar.getAccessibleContext().setAccessibleName(Ferramenta_Imagens.DICA_APLICAR); aplicar.setBounds(10, 5, 150, 25); pnBotoes.add(aplicar); } /* * Colocar os controles */ pnRegra.setBackground(CoresDefault.getCorPaineis()); regraFonteBtn.add(pnRegra, BorderLayout.NORTH); textAreaSourceCode.setBorder(criaBorda("")); textAreaSourceCode.setBackground(CoresDefault.getCorPaineis()); JSplitPane splitPane = null; Dimension minimumSize = new Dimension(0, 0); // JScrollPane ajudaScrollPane = new // JScrollPane(ajuda,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); sp.setMinimumSize(minimumSize); sp.setPreferredSize(new Dimension(150, 90)); splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, sp, textAreaSourceCode); splitPane.setOneTouchExpandable(true); // splitPane.set // splitPane.setDividerLocation(0.95); int w = parentFrame.getWidth(); int s = w / 4; splitPane.setDividerLocation(s); // regraFonteBtn.add(scrollPaneCorrecaoLabel, BorderLayout.CENTER); regraFonteBtn.add(splitPane, BorderLayout.CENTER); pnBotoes.setPreferredSize(new Dimension(600, 35)); pnBotoes.setBackground(CoresDefault.getCorPaineis()); // regraFonteBtn.add(pnBotoes, BorderLayout.SOUTH); regraFonteBtn.setBackground(CoresDefault.getCorPaineis()); contentPane.add(regraFonteBtn); JPanel textoErrosBtn = new JPanel(); textoErrosBtn.setLayout(new BorderLayout()); pnSetaDescricao.setBackground(CoresDefault.getCorPaineis()); pnSetaDescricao.add(pnBotoes, cons); textoErrosBtn.add(pnSetaDescricao, BorderLayout.NORTH); textoErrosBtn.add(pnListaErros, BorderLayout.CENTER); JPanel pnSalvarCancelar = new JPanel(); pnSalvarCancelar.setLayout(null); pnSalvarCancelar.setPreferredSize(new Dimension(600, 35)); pnSalvarCancelar.add(salvar); pnSalvarCancelar.add(abrir); pnSalvarCancelar.add(cancelar); if (!original) { reverter = new JButton("Reverter"); reverter.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { setVisible(false); TxtBuffer.setContent(TxtBuffer.getContentOriginal()); parentFrame.showPainelFerramentaImgPArq(TxtBuffer.getContentOriginal(), enderecoPagina); setVisible(true); } }); //reverter.setActionCommand("Reverter"); reverter.setText(TradPainelRelatorio.REVERTER); reverter.setToolTipText(TradPainelRelatorio.DICA_REVERTER); reverter.getAccessibleContext().setAccessibleDescription(TradPainelRelatorio.DICA_REVERTER); reverter.getAccessibleContext().setAccessibleName(TradPainelRelatorio.DICA_REVERTER); if (EstadoSilvinha.conteudoEmPainelResumo) { reverter.setBounds(640, 0, 150, 25); } else { reverter.setBounds(480, 0, 150, 25); } pnSalvarCancelar.add(reverter); } if (EstadoSilvinha.conteudoEmPainelResumo) { pnSalvarCancelar.add(analiseSistematica); } pnSalvarCancelar.setBackground(CoresDefault.getCorPaineis()); textoErrosBtn.add(pnSalvarCancelar, BorderLayout.SOUTH); pnListaErros.setBackground(CoresDefault.getCorPaineis()); textoErrosBtn.add(pnListaErros, BorderLayout.CENTER); if (tableLinCod.getRowCount() == 0) tableLinCod.addLinha(0, 0, GERAL.DOC_SEM_ERROS); contentPane.setBackground(CoresDefault.getCorPaineis()); contentPane.add(textoErrosBtn); this.setVisible(true); }
From source file:lol.search.RankedStatsPage.java
private JPanel statsPanel() { JPanel panel = new JPanel(); panel.setBorder(BorderFactory.createLineBorder(Color.DARK_GRAY)); panel.setOpaque(false);//from w w w . j ava2 s. c o m panel.setLayout(new FlowLayout()); panel.setPreferredSize(new Dimension(910, 464)); JPanel statsPanelTotals = new JPanel(); statsPanelTotals.setLayout(new BoxLayout(statsPanelTotals, BoxLayout.X_AXIS)); statsPanelTotals.setOpaque(false); //statsPanelTotals.setBorder(BorderFactory.createLineBorder(Color.DARK_GRAY)); //totals statsPanelTotals.setPreferredSize(new Dimension(910, 45)); totalJLabel(winsLabel, " W: ", Color.WHITE); winsLabel.setAlignmentX(Component.LEFT_ALIGNMENT); totalJLabel(totalWins, "" + this.wins, valueOrange); totalJLabel(lossesLabel, " L: ", Color.WHITE); totalJLabel(totalLosses, "" + this.losses, valueOrange); totalJLabel(winPercentLabel, " Win Ratio: ", Color.WHITE); totalJLabel(winPercent, winPercentage + "%", valueOrange); totalJLabel(totalGames, " Total Games Played: ", Color.WHITE); totalJLabel(this.totalGamesPlayed, String.valueOf(totalGamesInt), valueOrange); statsPanelTotals.add(winsLabel); statsPanelTotals.add(totalWins); statsPanelTotals.add(lossesLabel); statsPanelTotals.add(totalLosses); statsPanelTotals.add(winPercentLabel); statsPanelTotals.add(winPercent); statsPanelTotals.add(totalGames); statsPanelTotals.add(totalGamesPlayed); JPanel totalsAndAverages = new JPanel(); totalsAndAverages.setOpaque(false); totalsAndAverages.setBorder(BorderFactory.createLineBorder(Color.DARK_GRAY)); totalsAndAverages.setPreferredSize(new Dimension(910, 405)); totalsAndAverages.setLayout(new GridLayout()); JPanel leftSide = new JPanel(); leftSide.setOpaque(false); leftSide.setBorder(BorderFactory.createLineBorder(Color.DARK_GRAY)); JPanel leftSideHeader = new JPanel(); leftSideHeader.setOpaque(false); leftSideHeader.setLayout(new FlowLayout()); leftSideHeader.setPreferredSize(new Dimension(455, 35)); //leftSideHeader.setBorder(BorderFactory.createLineBorder(Color.CYAN)); totalJLabel(this.leftSideHeaderLabel, " Per Game Averages:", Color.WHITE); leftSideHeader.add(this.leftSideHeaderLabel); JPanel leftSideBody = new JPanel(); leftSideBody.setOpaque(false); leftSideBody.setLayout(new FlowLayout(FlowLayout.LEFT)); leftSideBody.setPreferredSize(new Dimension(250, 360)); //leftSideBody.setBorder(BorderFactory.createLineBorder(Color.RED)); JPanel avgKillsPanel = new JPanel(); avgKillsPanel.setOpaque(false); //avgKillsPanel.setBorder(BorderFactory.createLineBorder(Color.CYAN)); JPanel avgDeathsPanel = new JPanel(); avgDeathsPanel.setOpaque(false); JPanel avgAssistsPanel = new JPanel(); avgAssistsPanel.setOpaque(false); JPanel avgMinionsPanel = new JPanel(); avgMinionsPanel.setOpaque(false); JPanel avgDoubleKillsPanel = new JPanel(); avgDoubleKillsPanel.setOpaque(false); JPanel avgTripleKillsPanel = new JPanel(); avgTripleKillsPanel.setOpaque(false); JPanel avgQuadKillsPanel = new JPanel(); avgQuadKillsPanel.setOpaque(false); JPanel avgPentaKillsPanel = new JPanel(); avgPentaKillsPanel.setOpaque(false); totalJLabel(this.avgKillsLabel, " Avg. Kills: ", Color.WHITE); totalJLabel(this.avgDeathsLabel, " Avg. Deaths: ", Color.WHITE); totalJLabel(this.avgAssistsLabel, " Avg. Assists: ", Color.WHITE); totalJLabel(this.avgMinionKillsLabel, " Avg. Minion Kills: ", Color.WHITE); totalJLabel(this.avgDoubleKillsLabel, " Avg. Double Kills: ", Color.WHITE); totalJLabel(this.avgTripleKillsLabel, " Avg. Triple Kills: ", Color.WHITE); totalJLabel(this.avgQuadKillsLabel, " Avg. Quadra Kills: ", Color.WHITE); totalJLabel(this.avgPentaKillsLabel, " Avg. Penta Kills: ", Color.WHITE); double totalKills = 00000; double totalDeaths = 00000; double totalAssists = 00000; double totalMinions = 00000; double totalDoubleKills = 00000; double totalTripleKills = 00000; double totalQuadraKills = 00000; double totalPentaKills = 00000; double avgKills = 99999; double avgAssists = 99999; double avgDeaths = 99999; double avgMinions = 99999; double avgDoubleKills = 99999; double avgTripleKills = 99999; double avgQuadraKills = 99999; double avgPentaKills = 99999; try { double totalGamesPlayed = this.objChampRankedList.get(0).getJSONObject("stats") .getInt("totalSessionsPlayed"); //operations totalKills = this.objChampRankedList.get(0).getJSONObject("stats").getInt("totalChampionKills"); avgKills = totalKills / totalGamesPlayed; totalDeaths = this.objChampRankedList.get(0).getJSONObject("stats").getInt("totalDeathsPerSession"); avgDeaths = totalDeaths / totalGamesPlayed; totalAssists = this.objChampRankedList.get(0).getJSONObject("stats").getInt("totalAssists"); avgAssists = totalAssists / totalGamesPlayed; totalMinions = this.objChampRankedList.get(0).getJSONObject("stats").getInt("totalMinionKills"); avgMinions = totalMinions / totalGamesPlayed; totalDoubleKills = this.objChampRankedList.get(0).getJSONObject("stats").getInt("totalDoubleKills"); avgDoubleKills = totalDoubleKills / totalGamesPlayed; totalTripleKills = this.objChampRankedList.get(0).getJSONObject("stats").getInt("totalTripleKills"); avgTripleKills = totalTripleKills / totalGamesPlayed; totalQuadraKills = this.objChampRankedList.get(0).getJSONObject("stats").getInt("totalQuadraKills"); avgQuadraKills = totalQuadraKills / totalGamesPlayed; totalPentaKills = this.objChampRankedList.get(0).getJSONObject("stats").getInt("totalPentaKills"); avgPentaKills = totalPentaKills / totalGamesPlayed; } catch (JSONException ex) { Logger.getLogger(RankedStatsPage.class.getName()).log(Level.SEVERE, null, ex); } String avgKillsString = new DecimalFormat("##.##").format(avgKills); String avgDeathsString = new DecimalFormat("##.##").format(avgDeaths); String avgAssistsString = new DecimalFormat("##.##").format(avgAssists); String avgMinionsString = new DecimalFormat("##.##").format(avgMinions); String avgDoubleKillsString = new DecimalFormat("##.##").format(avgDoubleKills); String avgTripleKillsString = new DecimalFormat("##.##").format(avgTripleKills); String avgQuadraKillsString = new DecimalFormat("##.##").format(avgQuadraKills); String avgPentaKillsString = new DecimalFormat("##.##").format(avgPentaKills); totalJLabel(this.avgKillsLabelValue, avgKillsString, valueOrange); totalJLabel(this.avgDeathsLabelValue, avgDeathsString, valueOrange); totalJLabel(this.avgAssistsLabelValue, avgAssistsString, valueOrange); totalJLabel(this.avgMinionKillsLabelValue, avgMinionsString, valueOrange); totalJLabel(this.avgDoubleKillsLabelValue, avgDoubleKillsString, valueOrange); totalJLabel(this.avgTripleKillsLabelValue, avgTripleKillsString, valueOrange); totalJLabel(this.avgQuadKillsLabelValue, avgQuadraKillsString, valueOrange); totalJLabel(this.avgPentaKillsLabelValue, avgPentaKillsString, valueOrange); avgKillsPanel.add(avgKillsLabel); avgKillsPanel.add(avgKillsLabelValue); avgDeathsPanel.add(avgDeathsLabel); avgDeathsPanel.add(avgDeathsLabelValue); avgAssistsPanel.add(avgAssistsLabel); avgAssistsPanel.add(avgAssistsLabelValue); avgMinionsPanel.add(avgMinionKillsLabel); avgMinionsPanel.add(avgMinionKillsLabelValue); avgDoubleKillsPanel.add(avgDoubleKillsLabel); avgDoubleKillsPanel.add(avgDoubleKillsLabelValue); avgTripleKillsPanel.add(avgTripleKillsLabel); avgTripleKillsPanel.add(avgTripleKillsLabelValue); avgQuadKillsPanel.add(avgQuadKillsLabel); avgQuadKillsPanel.add(avgQuadKillsLabelValue); avgPentaKillsPanel.add(avgPentaKillsLabel); avgPentaKillsPanel.add(avgPentaKillsLabelValue); leftSideBody.add(avgKillsPanel); leftSideBody.add(avgDeathsPanel); leftSideBody.add(avgAssistsPanel); leftSideBody.add(avgMinionsPanel); leftSideBody.add(avgDoubleKillsPanel); leftSideBody.add(avgTripleKillsPanel); leftSideBody.add(avgQuadKillsPanel); leftSideBody.add(avgPentaKillsPanel); leftSide.add(leftSideHeader); leftSide.add(leftSideBody); JPanel rightSide = new JPanel(); /**/ rightSide.setOpaque(false); rightSide.setBorder(BorderFactory.createLineBorder(Color.DARK_GRAY)); JPanel rightSideHeader = new JPanel(); rightSideHeader.setOpaque(false); rightSideHeader.setLayout(new FlowLayout()); rightSideHeader.setPreferredSize(new Dimension(455, 35)); //rightSideHeader.setBorder(BorderFactory.createLineBorder(Color.MAGENTA)); totalJLabel(this.rightSideHeaderLabel, " Season Totals:", Color.WHITE); rightSideHeader.add(this.rightSideHeaderLabel); JPanel rightSideBody = new JPanel(); rightSideBody.setOpaque(false); rightSideBody.setLayout(new FlowLayout(FlowLayout.LEFT)); rightSideBody.setPreferredSize(new Dimension(270, 360)); //rightSideBody.setBorder(BorderFactory.createLineBorder(Color.MAGENTA)); JPanel totalKillsPanel = new JPanel(); totalKillsPanel.setOpaque(false); JPanel totalDeathsPanel = new JPanel(); totalDeathsPanel.setOpaque(false); JPanel totalAssistsPanel = new JPanel(); totalAssistsPanel.setOpaque(false); JPanel totalMinionsPanel = new JPanel(); totalMinionsPanel.setOpaque(false); JPanel totalDoubleKillsPanel = new JPanel(); totalDoubleKillsPanel.setOpaque(false); JPanel totalTripleKillsPanel = new JPanel(); totalTripleKillsPanel.setOpaque(false); JPanel totalQuadKillsPanel = new JPanel(); totalQuadKillsPanel.setOpaque(false); JPanel totalPentaKillsPanel = new JPanel(); totalPentaKillsPanel.setOpaque(false); totalJLabel(this.totalKillsLabel, " Total Kills: ", Color.WHITE); totalJLabel(this.totalKillsLabelValue, new DecimalFormat("#######").format(totalKills), valueOrange); totalJLabel(this.totalDeathsLabel, " Total Deaths: ", Color.WHITE); totalJLabel(this.totalDeathsLabelValue, new DecimalFormat("#######").format(totalDeaths), valueOrange); totalJLabel(this.totalAssistsLabel, " Total Assists: ", Color.WHITE); totalJLabel(this.totalAssistsLabelValue, new DecimalFormat("#######").format(totalAssists), valueOrange); totalJLabel(this.totalMinionsLabel, " Total Minion Kills: ", Color.WHITE); totalJLabel(this.totalMinionsLabelValue, new DecimalFormat("#######").format(totalMinions), valueOrange); totalJLabel(this.totalDoubleKillsLabel, " Total Double Kills: ", Color.WHITE); totalJLabel(this.totalDoubleKillsLabelValue, new DecimalFormat("#######").format(totalDoubleKills), valueOrange); totalJLabel(this.totalTripleKillsLabel, " Total Triple Kills: ", Color.WHITE); totalJLabel(this.totalTripleKillsLabelValue, new DecimalFormat("#######").format(totalTripleKills), valueOrange); totalJLabel(this.totalQuadKillsLabel, " Total Quadra Kills: ", Color.WHITE); totalJLabel(this.totalQuadKillsLabelValue, new DecimalFormat("#######").format(totalQuadraKills), valueOrange); totalJLabel(this.totalPentaKillsLabel, " Total Penta Kills: ", Color.WHITE); totalJLabel(this.totalPentaKillsLabelValue, new DecimalFormat("#######").format(totalPentaKills), valueOrange); totalKillsPanel.add(totalKillsLabel); totalKillsPanel.add(totalKillsLabelValue); totalDeathsPanel.add(totalDeathsLabel); totalDeathsPanel.add(totalDeathsLabelValue); totalAssistsPanel.add(totalAssistsLabel); totalAssistsPanel.add(totalAssistsLabelValue); totalMinionsPanel.add(totalMinionsLabel); totalMinionsPanel.add(totalMinionsLabelValue); totalDoubleKillsPanel.add(totalDoubleKillsLabel); totalDoubleKillsPanel.add(totalDoubleKillsLabelValue); totalTripleKillsPanel.add(totalTripleKillsLabel); totalTripleKillsPanel.add(totalTripleKillsLabelValue); totalQuadKillsPanel.add(totalQuadKillsLabel); totalQuadKillsPanel.add(totalQuadKillsLabelValue); totalPentaKillsPanel.add(totalPentaKillsLabel); totalPentaKillsPanel.add(totalPentaKillsLabelValue); rightSideBody.add(totalKillsPanel); rightSideBody.add(totalDeathsPanel); rightSideBody.add(totalAssistsPanel); rightSideBody.add(totalMinionsPanel); rightSideBody.add(totalDoubleKillsPanel); rightSideBody.add(totalTripleKillsPanel); rightSideBody.add(totalQuadKillsPanel); rightSideBody.add(totalPentaKillsPanel); //rightSideBody.setBorder(BorderFactory.createLineBorder(Color.RED)); rightSide.add(rightSideHeader); rightSide.add(rightSideBody); totalsAndAverages.add(rightSide); totalsAndAverages.add(leftSide); panel.add(statsPanelTotals); panel.add(totalsAndAverages); return panel; }