List of usage examples for javax.swing JLabel setFont
@BeanProperty(preferred = true, visualUpdate = true, description = "The font for the component.") public void setFont(Font font)
From source file:FontDemoLabel.java
public FontDemoLabel() { super("Font Demo - Label"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Container cp = getContentPane(); // get font name list fl = GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames(); // IGNORE the setLayout and North/South stuff... // we will discuss it in a few pages! cp.setLayout(new BorderLayout()); cp.add(BorderLayout.NORTH, new Label("Number of Fonts = " + fl.length, Label.CENTER)); cp.add(BorderLayout.CENTER, p = new JPanel()); p.setLayout(new GridLayout(5, 0, 5, 5)); for (int i = 0; i < fl.length; i++) { JLabel lab; // The crux of the matter: for each font name, // create a label using the name as the text, // AND set the font to be the named font! p.add(lab = new JLabel(fl[i])); lab.setFont(new Font(fl[i], Font.ITALIC | Font.BOLD, 14)); }// w w w .j av a2 s . co m pack(); }
From source file:com.intel.stl.ui.common.view.ComponentFactory.java
public static JLabel getFieldLabel(String text, Color clr) { JLabel label = new JLabel(text); label.setForeground(clr);//from w w w . j a va2 s .c om label.setFont(UIConstants.H5_FONT.deriveFont(Font.BOLD)); return label; }
From source file:com.intel.stl.ui.common.view.ComponentFactory.java
public static JLabel getFieldContent(String text, Color clr) { JLabel label = new JLabel(text); label.setForeground(clr);/*from w w w . j a v a 2 s . c om*/ label.setFont(UIConstants.H3_FONT); return label; }
From source file:integratedprogressdemo.WeatherData.java
private WeatherData(boolean displayProgress) { setBackground(Color.WHITE);//from ww w .j a v a 2s .co m setLayout(new BorderLayout()); JLabel lbl = new JLabel("World-Wide Weather Data"); lbl.setFont(new Font("Serif", Font.PLAIN, 18)); add(lbl, BorderLayout.PAGE_START); lbl = new JLabel("Weather information from over 50 cities"); add(lbl, BorderLayout.LINE_START); if (displayProgress) { progressPanel = new JPanel(); progressPanel.setBackground(Color.WHITE); progressPanel.setLayout(new BorderLayout(20, 20)); String lblText = "<html>Stuck in the mud? Make progress with...<br /><font color=red><em>JDK Documentation</em></font><br/></html>"; lbl = new JLabel(lblText); progressPanel.add(lbl, BorderLayout.NORTH); progressBar = new JProgressBar(0, 100); progressBar.setValue(0); progressBar.setStringPainted(true); progressPanel.add(progressBar, BorderLayout.SOUTH); add(progressPanel, BorderLayout.LINE_END); } String[] columnNames = { "City", "Temperature" }; JTable table = new JTable(getData(), columnNames); table.setPreferredScrollableViewportSize(new Dimension(500, 70)); table.setFillsViewportHeight(true); //Create the scroll pane and add the table to it. JScrollPane scrollPane = new JScrollPane(table); scrollPane.setBackground(Color.WHITE); //Add the scroll pane to this panel. add(scrollPane, BorderLayout.PAGE_END); }
From source file:com.antelink.sourcesquare.gui.view.ExitSourceSquareView.java
/** * Create the frame.//from w w w. ja v a 2 s . c o m */ public ExitSourceSquareView() { setIconImage(Toolkit.getDefaultToolkit().getImage(SourceSquareView.class.getResource("/antelink.png"))); setTitle("SourceSquare"); setResizable(false); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 500, 170); this.contentPane = new JPanel(); this.contentPane.setBackground(Color.WHITE); this.contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(this.contentPane); this.mainPanel = new JPanel(); this.mainPanel.setBackground(Color.WHITE); GroupLayout gl_contentPane = new GroupLayout(this.contentPane); gl_contentPane.setHorizontalGroup(gl_contentPane.createParallelGroup(Alignment.LEADING) .addComponent(this.mainPanel, GroupLayout.DEFAULT_SIZE, 428, Short.MAX_VALUE)); gl_contentPane.setVerticalGroup(gl_contentPane.createParallelGroup(Alignment.LEADING) .addComponent(this.mainPanel, GroupLayout.DEFAULT_SIZE, 263, Short.MAX_VALUE)); this.mainPanel.setLayout(new BoxLayout(this.mainPanel, BoxLayout.Y_AXIS)); JPanel panel_1 = new JPanel(); panel_1.setBackground(Color.WHITE); this.mainPanel.add(panel_1); panel_1.setLayout(new BorderLayout(0, 0)); JPanel panel = new JPanel(); panel.setLayout(new FlowLayout(FlowLayout.CENTER, 50, 20)); panel.setBackground(Color.WHITE); panel_1.add(panel, BorderLayout.SOUTH); Image openButtonImage = Toolkit.getDefaultToolkit() .getImage(SourceSquareView.class.getResource("/OpenButton.png")); this.openButtonLabel = new JLabel(new ImageIcon(openButtonImage)); this.openButtonLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); panel.add(this.openButtonLabel); JLabel exitLabel = new JLabel("<html><b>Closing this window will quit the application</b></html>"); exitLabel.setFont(new Font("Helvetica", Font.PLAIN, 13)); JLabel explainLabel = new JLabel("<html>(You won't be able to see or publish your results anymore)</html>"); explainLabel.setFont(new Font("Helvetica", Font.PLAIN, 13)); JPanel textPanel = new JPanel(); textPanel.setBackground(Color.WHITE); textPanel.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 0)); textPanel.add(exitLabel, BorderLayout.CENTER); textPanel.add(explainLabel, BorderLayout.CENTER); panel_1.add(textPanel, BorderLayout.CENTER); CopyrightPanel copyrightPanel = new CopyrightPanel(); copyrightPanel.setBackground(Color.WHITE); this.mainPanel.add(copyrightPanel); this.contentPane.setLayout(gl_contentPane); setLocationRelativeTo(null); }
From source file:edu.ku.brc.specify.tasks.subpane.wb.ImportDataFileInfo.java
/** * shows modified (truncated) data after import */// w ww . j a v a 2s .c o m protected void showModifiedData() { if (importer.getTruncations().size() > 0) { JPanel mainPane = new JPanel(new BorderLayout()); JLabel msg = createLabel(getResourceString("WB_TRUNCATIONS")); msg.setFont(msg.getFont().deriveFont(Font.BOLD)); mainPane.add(msg, BorderLayout.NORTH); String[] heads = new String[3]; String[][] vals = new String[importer.getTruncations().size()][3]; heads[0] = getResourceString("WB_ROW"); heads[1] = getResourceString("WB_COLUMN"); heads[2] = getResourceString("WB_TRUNCATED"); int row = 0; for (DataImportTruncation trunc : importer.getTruncations()) { vals[row][0] = String.valueOf(trunc.getRow()); vals[row][1] = trunc.getColHeader(); if (vals[row][1].equals("")) { vals[row][1] = String.valueOf(trunc.getCol() + 1); } vals[row++][2] = trunc.getExcluded(); } JTable mods = new JTable(vals, heads); mods.setDefaultRenderer(String.class, new BiColorTableCellRenderer(false)); mainPane.add(UIHelper.createScrollPane(mods), BorderLayout.CENTER); CustomFrame cwin = new CustomFrame(getResourceString(MODIFIED_IMPORT_DATA), CustomFrame.OKHELP, mainPane); cwin.setHelpContext("WorkbenchImportData"); //help context could be more specific cwin.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); UIHelper.centerAndShow(cwin); } if (importer.getMessages().size() > 0) { JPanel mainPane = new JPanel(new BorderLayout()); JTextArea msgs = new JTextArea(); msgs.setRows(importer.getMessages().size()); for (String msg : importer.getMessages()) { msgs.append(msg); msgs.append("\n"); } mainPane.add(msgs, BorderLayout.CENTER); CustomFrame cwin = new CustomFrame(getResourceString(MODIFIED_IMPORT_DATA), CustomFrame.OKHELP, mainPane); cwin.setHelpContext("WorkbenchImportData"); //help context could be more specific cwin.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); UIHelper.centerAndShow(cwin); } }
From source file:com.intel.stl.ui.common.view.ComponentFactory.java
public static JLabel getIntelH1Label(String text, int style) { JLabel label = new JLabel(text); label.setForeground(UIConstants.INTEL_BLUE); label.setFont(UIConstants.H1_FONT.deriveFont(style)); return label; }
From source file:com.intel.stl.ui.common.view.ComponentFactory.java
public static JLabel getIntelH2Label(String text, int style) { JLabel label = new JLabel(text); label.setForeground(UIConstants.INTEL_BLUE); label.setFont(UIConstants.H2_FONT.deriveFont(style)); return label; }
From source file:com.intel.stl.ui.common.view.ComponentFactory.java
public static JLabel getIntelH3Label(String text, int style) { JLabel label = new JLabel(text); label.setForeground(UIConstants.INTEL_BLUE); label.setFont(UIConstants.H3_FONT.deriveFont(style)); return label; }
From source file:com.github.alexfalappa.nbspringboot.projects.initializr.InitializrProjectPanelVisual2.java
/** * Fixes the boot version of the dependencies. * <p>/*from w w w . jav a 2 s . c om*/ * Does nothing if the panel has not been initialized. * * @param bootVersion */ public void fixBootVersion(String bootVersion) { Objects.requireNonNull(bootVersion); if (initialized) { // substitute combo with label javax.swing.GroupLayout layout = (javax.swing.GroupLayout) this.getLayout(); final JLabel label = new JLabel(bootVersion); label.setFont(label.getFont().deriveFont(Font.BOLD)); layout.replace(cbBootVersion, label); // adapt dependencies panel pBootDependencies.adaptToBootVersion(bootVersion); } }