List of usage examples for javax.swing JLabel setForeground
@BeanProperty(preferred = true, visualUpdate = true, description = "The foreground color of the component.") public void setForeground(Color fg)
From source file:com.openbravo.pos.sales.JRetailTicketPreviewTicket.java
private JPanel getLabelPanel(String msg, Color colour) { JPanel panel = new JPanel(); Font font = new Font("Verdana", Font.BOLD, 12); panel.setFont(font);// ww w . j a v a 2 s .c o m panel.setOpaque(true); // panel.setBackground(Color.BLUE); JLabel label = new JLabel(msg, JLabel.LEFT); label.setForeground(colour); label.setHorizontalAlignment(javax.swing.SwingConstants.LEFT); panel.add(label); return panel; }
From source file:net.pms.newgui.StatusTab.java
public JComponent build() { // Apply the orientation for the locale ComponentOrientation orientation = ComponentOrientation.getOrientation(PMS.getLocale()); String colSpec = FormLayoutUtil.getColSpec("pref, 30dlu, fill:pref:grow, 30dlu, pref", orientation); // 1 2 3 4 5 FormLayout layout = new FormLayout(colSpec, // 1 2 3 4 5 // ////////////////////////////////////////////////// "p," // Detected Media Renderers --------------------// 1 + "9dlu," // // + "fill:p:grow," // <renderers> // 3 + "3dlu," // // + "p," // ---------------------------------------------// 5 + "3dlu," // | | // + "p," // Connected | Memory Usage |<bitrate> // 7 + "3dlu," // | | // + "p," // <icon> | <statusbar> | // 9 ////////////////////////////////////////////////// );/*ww w .ja v a 2 s . com*/ PanelBuilder builder = new PanelBuilder(layout); builder.border(Borders.DIALOG); builder.opaque(true); CellConstraints cc = new CellConstraints(); // Renderers JComponent cmp = builder.addSeparator(Messages.getString("StatusTab.9"), FormLayoutUtil.flip(cc.xyw(1, 1, 5), colSpec, orientation)); cmp = (JComponent) cmp.getComponent(0); Font bold = cmp.getFont().deriveFont(Font.BOLD); Color fgColor = new Color(68, 68, 68); cmp.setFont(bold); renderers = new JPanel(new GuiUtil.WrapLayout(FlowLayout.CENTER, 20, 10)); JScrollPane rsp = new JScrollPane(renderers, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); rsp.setBorder(BorderFactory.createEmptyBorder()); rsp.setPreferredSize(new Dimension(0, 260)); rsp.getHorizontalScrollBar().setLocation(0, 250); builder.add(rsp, cc.xyw(1, 3, 5)); cmp = builder.addSeparator(null, FormLayoutUtil.flip(cc.xyw(1, 5, 5), colSpec, orientation)); // Connected jl = new JLabel(Messages.getString("StatusTab.3")); builder.add(jl, FormLayoutUtil.flip(cc.xy(1, 7, "center, top"), colSpec, orientation)); jl.setFont(bold); jl.setForeground(fgColor); imagePanel = buildImagePanel("/resources/images/icon-status-connecting.png"); builder.add(imagePanel, FormLayoutUtil.flip(cc.xy(1, 9), colSpec, orientation)); // Memory memBarUI = new GuiUtil.SegmentedProgressBarUI(Color.white, Color.gray); memBarUI.setActiveLabel("{}", Color.white, 0); memBarUI.setActiveLabel("{}", Color.red, 90); memBarUI.addSegment("", memColor); memBarUI.addSegment("", bufColor); memBarUI.setTickMarks(getTickMarks(), "{}"); memoryProgressBar = new GuiUtil.CustomUIProgressBar(0, 100, memBarUI); memoryProgressBar.setStringPainted(true); memoryProgressBar.setForeground(new Color(75, 140, 181)); memoryProgressBar.setString(Messages.getString("StatusTab.5")); JLabel mem = builder .addLabel( "<html><b>" + Messages.getString("StatusTab.6") + "</b> (" + Messages.getString("StatusTab.12") + ")</html>", FormLayoutUtil.flip(cc.xy(3, 7), colSpec, orientation)); mem.setForeground(fgColor); builder.add(memoryProgressBar, FormLayoutUtil.flip(cc.xyw(3, 9, 1), colSpec, orientation)); // Bitrate String bitColSpec = "left:pref, 3dlu, right:pref:grow"; PanelBuilder bitrateBuilder = new PanelBuilder(new FormLayout(bitColSpec, "p, 1dlu, p, 1dlu, p")); bitrateLabel = new JLabel("<html><b>" + Messages.getString("StatusTab.13") + "</b> (" + Messages.getString("StatusTab.11") + ")</html>"); bitrateLabel.setForeground(fgColor); bitrateBuilder.add(bitrateLabel, FormLayoutUtil.flip(cc.xy(1, 1), bitColSpec, orientation)); currentBitrateLabel = new JLabel(Messages.getString("StatusTab.14")); currentBitrateLabel.setForeground(fgColor); bitrateBuilder.add(currentBitrateLabel, FormLayoutUtil.flip(cc.xy(1, 3), bitColSpec, orientation)); currentBitrate = new JLabel("0"); currentBitrate.setForeground(fgColor); bitrateBuilder.add(currentBitrate, FormLayoutUtil.flip(cc.xy(3, 3), bitColSpec, orientation)); peakBitrateLabel = new JLabel(Messages.getString("StatusTab.15")); peakBitrateLabel.setForeground(fgColor); bitrateBuilder.add(peakBitrateLabel, FormLayoutUtil.flip(cc.xy(1, 5), bitColSpec, orientation)); peakBitrate = new JLabel("0"); peakBitrate.setForeground(fgColor); bitrateBuilder.add(peakBitrate, FormLayoutUtil.flip(cc.xy(3, 5), bitColSpec, orientation)); builder.add(bitrateBuilder.getPanel(), FormLayoutUtil.flip(cc.xywh(5, 7, 1, 3, "left, top"), colSpec, orientation)); JPanel panel = builder.getPanel(); // Apply the orientation to the panel and all components in it panel.applyComponentOrientation(orientation); JScrollPane scrollPane = new JScrollPane(panel, JScrollPane.VERTICAL_SCROLLBAR_NEVER, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); scrollPane.setBorder(BorderFactory.createEmptyBorder()); startMemoryUpdater(); return scrollPane; }
From source file:com.polivoto.vistas.Charts.java
public void getBotonesPreguntas(JPanel botones) { GridBagConstraints gridBagConstraints; boolean first = false; botones.removeAll();/*www .j av a 2 s . c om*/ 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:com.sshtools.appframework.ui.SshToolsApplication.java
/** * Show an 'About' dialog/* w w w.ja va 2s . c o m*/ */ public void showAbout(Component parent) { JPanel p = new JPanel(new GridBagLayout()); p.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4)); GridBagConstraints gBC = new GridBagConstraints(); gBC.anchor = GridBagConstraints.CENTER; gBC.fill = GridBagConstraints.HORIZONTAL; gBC.insets = new Insets(1, 1, 1, 1); JLabel a = new JLabel(getApplicationName()); a.setFont(a.getFont().deriveFont(24f)); UIUtil.jGridBagAdd(p, a, gBC, GridBagConstraints.REMAINDER); JLabel v = new JLabel("Version " + getApplicationVersion()); v.setFont(v.getFont().deriveFont(10f)); UIUtil.jGridBagAdd(p, v, gBC, GridBagConstraints.REMAINDER); MultilineLabel x = new MultilineLabel(getAboutLicenseDetails()); x.setBorder(BorderFactory.createEmptyBorder(8, 0, 8, 0)); x.setFont(x.getFont().deriveFont(12f)); UIUtil.jGridBagAdd(p, x, gBC, GridBagConstraints.REMAINDER); MultilineLabel c = new MultilineLabel(getExpiryInfo()); c.setFont(c.getFont().deriveFont(10f)); UIUtil.jGridBagAdd(p, c, gBC, GridBagConstraints.REMAINDER); final JLabel h = new JLabel(getAboutURL()); h.setForeground(Color.blue); h.setFont(new Font(h.getFont().getName(), Font.BOLD, 10)); h.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); h.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent evt) { try { BrowserLauncher.openURL(getAboutURL()); } catch (IOException ioe) { ioe.printStackTrace(); } } }); UIUtil.jGridBagAdd(p, h, gBC, GridBagConstraints.REMAINDER); JOptionPane.showMessageDialog(parent, p, "About", JOptionPane.PLAIN_MESSAGE, getApplicationLargeIcon()); }
From source file:ecg.ecgshow.ECGShowUI.java
private void createHeartRateData(long timeZone) { HeartRatedatas = new short[2]; HeartRateData = new JPanel(); //HeartRateData.setLayout(new BorderLayout()); HeartRateData.setLayout(new FlowLayout()); HeartRateData.setBounds(0, 0, (int) (WIDTH * 0.14), (int) (HEIGHT * 0.15)); HeartRateData.setBackground(Color.BLACK); JLabel jLabel1 = new JLabel("---"); if (HeartRatedatas[0] == 0x00 || HeartRatedatas == null) { jLabel1.setText("---"); } else {// w w w .j a v a 2 s .co m jLabel1.setText(Short.toString((short) HeartRatedatas[0])); } jLabel1.setFont(loadFont("LED.tff", (float) (HEIGHT * 0.070))); jLabel1.setBackground(Color.BLACK); jLabel1.setForeground(Color.GREEN); jLabel1.setBounds(0, 0, 100, 100); jLabel1.setOpaque(true); //?? JLabel jLabelName = new JLabel(" "); jLabelName.setFont(new Font("SansSerif", 0, (int) (HEIGHT * 0.020))); jLabelName.setBackground(Color.BLACK); jLabelName.setForeground(new Color(237, 65, 43)); jLabelName.setBounds(0, 0, 100, 100); jLabelName.setOpaque(true); //?? JLabel jLabelUnit = new JLabel(" bpm"); jLabelUnit.setFont(new Font("SansSerif", 0, (int) (HEIGHT * 0.020))); jLabelUnit.setBackground(Color.BLACK); jLabelUnit.setForeground(Color.GREEN); jLabelUnit.setBounds(0, 0, 100, 100); jLabelUnit.setOpaque(true); //?? HeartRateData.add(jLabelName); HeartRateData.add(jLabel1); HeartRateData.add(jLabelUnit); System.out.println("HeartRatedatas" + Short.toString(HeartRatedatas[0])); ScheduledExecutorService scheduledExecutorService = Executors.newSingleThreadScheduledExecutor(); scheduledExecutorService.scheduleAtFixedRate(new Runnable() { @Override public void run() { if (HeartRatedatas[0] == -100 || HeartRatedatas[0] == 156 || HeartRatedatas[0] == 0) { jLabel1.setText("--"); } else { jLabel1.setText(String.valueOf(HeartRatedatas[0])); } HeartRateData.repaint(); } }, 0, 3, TimeUnit.SECONDS); }
From source file:com.digitalgeneralists.assurance.ui.components.ComparisonResultPanel.java
private void addFileAttributeToPanel(Container panel, int anchor, int index, String label, String value) { Font attributeFont = new Font(this.getFont().getName(), Font.BOLD, 8); GridBagConstraints attributeLabelConstraints = new GridBagConstraints(); attributeLabelConstraints.anchor = anchor; attributeLabelConstraints.gridx = 0; attributeLabelConstraints.gridy = index; attributeLabelConstraints.weightx = 1.0; attributeLabelConstraints.weighty = 1.0; attributeLabelConstraints.gridheight = 1; attributeLabelConstraints.gridwidth = 1; attributeLabelConstraints.insets = new Insets(5, 5, 5, 5); JLabel attributeLabel = new JLabel(label); attributeLabel.setForeground(Color.gray); attributeLabel.setFont(attributeFont); panel.add(attributeLabel, attributeLabelConstraints); GridBagConstraints attributeValueConstraints = new GridBagConstraints(); attributeValueConstraints.anchor = anchor; attributeValueConstraints.gridx = 1; attributeValueConstraints.gridy = index; attributeValueConstraints.weightx = 1.0; attributeValueConstraints.weighty = 1.0; attributeValueConstraints.gridheight = 1; attributeValueConstraints.gridwidth = 1; attributeValueConstraints.insets = new Insets(5, 5, 5, 5); JLabel attributeValue = new JLabel(value); attributeValue.setForeground(Color.gray); attributeValue.setFont(attributeFont); panel.add(attributeValue, attributeValueConstraints); }
From source file:greenfoot.gui.export.ExportPublishPane.java
/** * Creates a login panel with a username and password and a create account option * @return Login panel Component/* w w w.ja va 2 s.com*/ */ private JComponent getLoginPanel() { JComponent loginPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 8, 4)); loginPanel.setBackground(background); loginPanel.setAlignmentX(LEFT_ALIGNMENT); Border border = BorderFactory.createCompoundBorder(BorderFactory.createLoweredBevelBorder(), BorderFactory.createEmptyBorder(12, 12, 12, 12)); loginPanel.setBorder(border); JLabel text = new JLabel(Config.getString("export.publish.login")); text.setForeground(headingColor); text.setVerticalAlignment(SwingConstants.TOP); loginPanel.add(text); text = new JLabel(Config.getString("export.publish.username"), SwingConstants.TRAILING); text.setFont(font); loginPanel.add(text); userNameField = new JTextField(10); userNameField.setInputVerifier(new InputVerifier() { @Override public boolean verify(JComponent input) { String text = userNameField.getText(); return text.length() > 0; } }); userNameField.addFocusListener(new FocusAdapter() { @Override public void focusLost(FocusEvent e) { checkForExistingScenario(); } }); loginPanel.add(userNameField); text = new JLabel(Config.getString("export.publish.password"), SwingConstants.TRAILING); text.setFont(font); loginPanel.add(text); passwordField = new JPasswordField(10); loginPanel.add(passwordField); JLabel createAccountLabel = new JLabel(Config.getString("export.publish.createAccount")); { createAccountLabel.setBackground(background); createAccountLabel.setHorizontalAlignment(SwingConstants.RIGHT); GreenfootUtil.makeLink(createAccountLabel, createAccountUrl); } loginPanel.add(createAccountLabel); return loginPanel; }
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 ww . j a va 2 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: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 ww w . j a v a 2s . c o m*/ } //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:greenfoot.gui.export.ExportPublishPane.java
/** * Build the component./* ww w. j a v a2 s .c o m*/ */ private void makePane() { font = (new JLabel()).getFont().deriveFont(Font.ITALIC, 11.0f); setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); setBorder(BorderFactory.createEmptyBorder(12, 12, 0, 12)); setBackground(backgroundColor); add(getHelpBox()); add(Box.createVerticalStrut(12)); infoPanel = new JPanel(new BorderLayout(22, 18)); { infoPanel.setAlignmentX(LEFT_ALIGNMENT); infoPanel.setBackground(background); Border border = BorderFactory.createCompoundBorder(BorderFactory.createLoweredBevelBorder(), BorderFactory.createEmptyBorder(12, 22, 12, 22)); infoPanel.setBorder(border); JLabel text = new JLabel(Config.getString("export.publish.info") + " " + serverName, SwingConstants.CENTER); text.setForeground(headingColor); infoPanel.add(text, BorderLayout.NORTH); createScenarioDisplay(); infoPanel.add(leftPanel, BorderLayout.CENTER); infoPanel.add(getTagDisplay(), BorderLayout.EAST); } add(infoPanel); add(Box.createVerticalStrut(16)); add(getLoginPanel()); add(Box.createVerticalStrut(10)); }