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:net.nosleep.superanalyzer.analysis.views.SummaryView.java
private void addStatTriple(JPanel panel, StringTriple triple) { JLabel wordLabel = new JLabel(triple.Name + ": "); wordLabel.setOpaque(false);/*from w ww. j a v a 2 s. co m*/ wordLabel.setFont(Theme.getFont(12)); wordLabel.setHorizontalAlignment(JLabel.RIGHT); panel.add(wordLabel); JLabel wordField = new JLabel(); wordField.setOpaque(false); wordField.setFont(Theme.getBoldFont(12)); wordField.setBorder(new javax.swing.border.EmptyBorder(1, 1, 1, 1)); wordField.setForeground(Theme.getColorSet()[0]); panel.add(wordField); wordField.setText(triple.Value); wordField.setToolTipText(Misc.getTooltip(triple.Info)); }
From source file:org.apache.taverna.activities.xpath.ui.contextualview.XPathActivityMainContextualView.java
@Override public JComponent getMainFrame() { jpMainPanel = new JPanel(new GridBagLayout()); jpMainPanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(4, 2, 4, 2), BorderFactory.createEmptyBorder())); GridBagConstraints c = new GridBagConstraints(); c.fill = GridBagConstraints.HORIZONTAL; c.anchor = GridBagConstraints.WEST; c.weighty = 0;//from w ww .j av a2s . com // --- XPath Expression --- c.gridx = 0; c.gridy = 0; c.insets = new Insets(5, 5, 5, 5); JLabel jlXPathExpression = new JLabel("XPath Expression:"); jlXPathExpression.setFont(jlXPathExpression.getFont().deriveFont(Font.BOLD)); jpMainPanel.add(jlXPathExpression, c); c.gridx++; c.weightx = 1.0; tfXPathExpression = new JTextField(); tfXPathExpression.setEditable(false); jpMainPanel.add(tfXPathExpression, c); // --- Label to Show/Hide Mapping Table --- final JLabel jlShowHideNamespaceMappings = new JLabel("Show namespace mappings..."); jlShowHideNamespaceMappings.setForeground(Color.BLUE); jlShowHideNamespaceMappings.setCursor(new Cursor(Cursor.HAND_CURSOR)); jlShowHideNamespaceMappings.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { spXPathNamespaceMappings.setVisible(!spXPathNamespaceMappings.isVisible()); jlShowHideNamespaceMappings.setText( (spXPathNamespaceMappings.isVisible() ? "Hide" : "Show") + " namespace mappings..."); thisContextualView.revalidate(); } }); c.gridx = 0; c.gridy++; c.gridwidth = 2; c.weightx = 1.0; c.weighty = 0; c.fill = GridBagConstraints.HORIZONTAL; jpMainPanel.add(jlShowHideNamespaceMappings, c); // --- Namespace Mapping Table --- xpathNamespaceMappingsTableModel = new DefaultTableModel() { /** * No cells should be editable */ public boolean isCellEditable(int rowIndex, int columnIndex) { return (false); } }; xpathNamespaceMappingsTableModel.addColumn("Namespace Prefix"); xpathNamespaceMappingsTableModel.addColumn("Namespace URI"); jtXPathNamespaceMappings = new JTable(); jtXPathNamespaceMappings.setModel(xpathNamespaceMappingsTableModel); jtXPathNamespaceMappings.setPreferredScrollableViewportSize(new Dimension(200, 90)); // TODO - next line is to be enabled when Taverna is migrated to Java // 1.6; for now it's fine to run without this // jtXPathNamespaceMappings.setFillsViewportHeight(true); // makes sure // that when the dedicated area is larger than the table, the latter is // stretched vertically to fill the empty space jtXPathNamespaceMappings.getColumnModel().getColumn(0).setPreferredWidth(20); // set // relative // sizes of // columns jtXPathNamespaceMappings.getColumnModel().getColumn(1).setPreferredWidth(300); c.gridy++; spXPathNamespaceMappings = new JScrollPane(jtXPathNamespaceMappings); spXPathNamespaceMappings.setVisible(false); jpMainPanel.add(spXPathNamespaceMappings, c); // populate the view with values refreshView(); return jpMainPanel; }
From source file:dpcs.About.java
public About() { setIconImage(Toolkit.getDefaultToolkit().getImage(About.class.getResource("/graphics/Icon.png"))); setResizable(false);/* w ww .java2 s . c o m*/ setType(Type.UTILITY); setTitle("About"); setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); setBounds(100, 100, 540, 400); contentPane = new JPanel(); contentPane.setBackground(Color.WHITE); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); contentPane.setLayout(null); try { InputStreamReader reader2 = new InputStreamReader( getClass().getResourceAsStream("/others/app-version.txt")); String tmp = IOUtils.toString(reader2); AppVersion = Double.parseDouble(tmp); } catch (IOException e1) { e1.printStackTrace(); } JButton btnGitHub = new JButton("GitHub"); btnGitHub.setToolTipText("Access Droid PC Suite github repository"); btnGitHub.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { try { Desktop.getDesktop().browse(new URL("https://github.com/kvsjxd/Droid-PC-Suite/").toURI()); } catch (Exception e) { e.printStackTrace(); } } }); btnGitHub.setBounds(369, 295, 111, 25); contentPane.add(btnGitHub); JLabel lblMyFriend4 = new JLabel("Gulati-kun"); lblMyFriend4.setFont(new Font("Dialog", Font.PLAIN, 15)); lblMyFriend4.setBounds(25, 266, 242, 24); contentPane.add(lblMyFriend4); JLabel lblMyFriend3 = new JLabel("Anil-kun"); lblMyFriend3.setFont(new Font("Dialog", Font.PLAIN, 15)); lblMyFriend3.setBounds(25, 242, 242, 24); contentPane.add(lblMyFriend3); JLabel lblMyFriend2 = new JLabel("Suri-kun"); lblMyFriend2.setFont(new Font("Dialog", Font.PLAIN, 15)); lblMyFriend2.setBounds(25, 217, 242, 24); contentPane.add(lblMyFriend2); JLabel lblApplicationVersion = new JLabel("Version: " + AppVersion); lblApplicationVersion.setFont(new Font("Dialog", Font.BOLD, 14)); lblApplicationVersion.setBounds(382, 16, 132, 18); contentPane.add(lblApplicationVersion); JLabel lblForMyOther = new JLabel("For my other Android stuff visit me on XDA - Developers (@kvsjxd)"); lblForMyOther.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent arg0) { try { Desktop.getDesktop().browse(new URL( "http://forum.xda-developers.com/member.php?s=82fb1dacfee601c8f79084b30d57d5a2&u=5640594") .toURI()); } catch (Exception e) { e.printStackTrace(); } } @Override public void mouseEntered(MouseEvent e) { lblForMyOther.setForeground(Color.BLUE); } @Override public void mouseExited(MouseEvent e) { lblForMyOther.setForeground(Color.BLACK); } }); lblForMyOther.setFont(new Font("Dialog", Font.PLAIN, 15)); lblForMyOther.setBounds(25, 321, 502, 24); contentPane.add(lblForMyOther); JLabel lblMySensei2 = new JLabel("Karun Sensei"); lblMySensei2.setFont(new Font("Dialog", Font.PLAIN, 15)); lblMySensei2.setBounds(25, 120, 242, 24); contentPane.add(lblMySensei2); JLabel lblMySensei1 = new JLabel("Prashotam Sensei"); lblMySensei1.setFont(new Font("Dialog", Font.PLAIN, 15)); lblMySensei1.setBounds(25, 98, 242, 24); contentPane.add(lblMySensei1); JLabel lblDaretobe = new JLabel("D4r3T0B3"); lblDaretobe.setFont(new Font("Dialog", Font.PLAIN, 15)); lblDaretobe.setBounds(25, 194, 242, 24); contentPane.add(lblDaretobe); JLabel label_9 = new JLabel(""); label_9.setToolTipText("This variation of android robot is created using Androidify"); label_9.setIcon(new ImageIcon(About.class.getResource("/graphics/Droidrobot.png"))); label_9.setBounds(334, 50, 180, 270); contentPane.add(label_9); JLabel lblDeveloper = new JLabel("Developer"); lblDeveloper.setFont(new Font("Dialog", Font.BOLD, 16)); lblDeveloper.setBounds(25, 12, 233, 24); contentPane.add(lblDeveloper); JLabel lblMrAleksandarDespotovski_shi = new JLabel("Aleksandar Despotovski-shi"); lblMrAleksandarDespotovski_shi.setFont(new Font("Dialog", Font.PLAIN, 15)); lblMrAleksandarDespotovski_shi.setBounds(25, 169, 242, 24); contentPane.add(lblMrAleksandarDespotovski_shi); JLabel lblMyname = new JLabel("Karanvir Singh"); lblMyname.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { try { Desktop.getDesktop().browse(new URL( "http://forum.xda-developers.com/member.php?s=82fb1dacfee601c8f79084b30d57d5a2&u=5640594") .toURI()); } catch (Exception e1) { e1.printStackTrace(); } } @Override public void mouseEntered(MouseEvent e) { lblMyname.setForeground(Color.BLUE); } @Override public void mouseExited(MouseEvent e) { lblMyname.setForeground(Color.RED); } }); lblMyname.setForeground(Color.RED); lblMyname.setFont(new Font("Dialog", Font.BOLD | Font.ITALIC, 16)); lblMyname.setBounds(25, 36, 242, 24); contentPane.add(lblMyname); JLabel lblMyFriend1 = new JLabel("My friend - Chetan-kun"); lblMyFriend1.setFont(new Font("Dialog", Font.PLAIN, 15)); lblMyFriend1.setBounds(25, 145, 242, 24); contentPane.add(lblMyFriend1); JLabel label_6 = new JLabel("Special thanks to"); label_6.setForeground(UIManager.getColor("OptionPane.questionDialog.titlePane.shadow")); label_6.setFont(new Font("Dialog", Font.BOLD, 16)); label_6.setBounds(25, 71, 240, 25); contentPane.add(label_6); JLabel lblGoogle = new JLabel( "Android, android green colored robot are trademarks of Google, Inc. We are not affliated with Google, Inc. in any way."); lblGoogle.setHorizontalAlignment(SwingConstants.LEFT); lblGoogle.setFont(new Font("Dialog", Font.PLAIN, 8)); lblGoogle.setBounds(25, 341, 514, 24); contentPane.add(lblGoogle); }
From source file:com.game.ui.views.WeaponEditorPanel.java
public void doGui() { setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); JLabel noteLbl = new JLabel( "<html><div style='width : 500px;'>Pls select a value to choose an Weapon or you can create a new " + "Weapon entity below. Once selected a weapon, its' details will be available below</div></html>"); noteLbl.setAlignmentX(0);/*from ww w .j a va 2 s. c om*/ add(noteLbl); DefaultComboBoxModel model = new DefaultComboBoxModel(); for (Item item : GameBean.weaponDetails) { if (item instanceof Weapon) { model.addElement(((Weapon) item).getName()); } } comboBox = new JComboBox(model); comboBox.setSelectedIndex(-1); comboBox.setMaximumSize(new Dimension(100, 30)); comboBox.setAlignmentX(0); comboBox.setActionCommand("dropDown"); comboBox.addActionListener(this); add(Box.createVerticalStrut(10)); add(comboBox); add(Box.createVerticalStrut(10)); JPanel panel1 = new JPanel(); panel1.setAlignmentX(0); panel1.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); panel1.setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c.fill = GridBagConstraints.NONE; c.anchor = GridBagConstraints.WEST; c.insets = new Insets(5, 5, 5, 5); c.weightx = 1; c.weighty = 1; c.gridwidth = 2; JLabel weaponDtsLbl = new JLabel("Weapon Details : "); weaponDtsLbl.setFont(new Font("Times New Roman", Font.BOLD, 15)); panel1.add(weaponDtsLbl, c); c.gridwidth = 1; c.gridy = 1; JLabel nameLbl = new JLabel("Name : "); panel1.add(nameLbl, c); c.gridx = 1; JTextField name = new JTextField(""); name.setColumns(20); panel1.add(name, c); c.gridx = 0; c.gridy = 2; JLabel weaponTypeLbl = new JLabel("Weapon Type : "); panel1.add(weaponTypeLbl, c); c.gridx = 1; JComboBox weaponType = new JComboBox(Configuration.weaponTypes); weaponType.setSelectedIndex(0); weaponType.setPreferredSize(name.getPreferredSize()); System.out.println(name.getPreferredSize()); panel1.add(weaponType, c); c.gridx = 0; c.gridy = 3; JLabel attackRangeLbl = new JLabel("Attack Range : "); panel1.add(attackRangeLbl, c); c.gridx = 1; JTextField attackRange = new JTextField(""); attackRange.setColumns(20); panel1.add(attackRange, c); c.gridx = 0; c.gridy = 4; JLabel attackPtsLbl = new JLabel("Attack Points : "); panel1.add(attackPtsLbl, c); c.gridx = 1; JTextField attackPts = new JTextField(""); attackPts.setColumns(20); panel1.add(attackPts, c); c.gridx = 0; c.gridy = 5; c.gridwidth = 2; JButton submit = new JButton("Save"); submit.addActionListener(this); submit.setActionCommand("button"); panel1.add(submit, c); c.gridx = 0; c.gridy = 6; c.gridwidth = 2; c.weighty = 0; c.weightx = 1; validationMess = new JLabel("Pls enter all the fields or pls choose a weapon from the drop down"); validationMess.setForeground(Color.red); validationMess.setVisible(false); panel1.add(validationMess, c); // c.fill = GridBagConstraints.BOTH; // c.gridy = 7; // c.weightx = 1; // c.weighty = 1; // panel1.add(new JLabel(""), c); panel1.setBorder(LineBorder.createGrayLineBorder()); add(panel1); add(Box.createVerticalGlue()); }
From source file:com.intel.stl.ui.main.view.NodeStatesPie.java
protected void fillLengendPanel(JPanel panel, PieDataset dataset, Color[] colors) { panel.removeAll();/*w w w . ja v a 2s .c om*/ GridBagConstraints gc = new GridBagConstraints(); gc.fill = GridBagConstraints.BOTH; int size = dataset.getItemCount(); stateLabels = new JLabel[size]; for (int i = 0; i < size; i++) { gc.insets = new Insets(2, 5, 2, 2); gc.weightx = 0; gc.gridwidth = 1; JLabel label = new JLabel(dataset.getKey(i).toString(), Util.generateImageIcon(colors[i], 8, new Insets(1, 1, 1, 1)), JLabel.LEFT); label.setFont(UIConstants.H5_FONT); label.setForeground(UIConstants.INTEL_DARK_GRAY); panel.add(label, gc); gc.gridwidth = GridBagConstraints.REMAINDER; gc.weightx = 0; stateLabels[i] = new JLabel(); stateLabels[i].setForeground(UIConstants.INTEL_DARK_GRAY); stateLabels[i].setFont(UIConstants.H3_FONT); panel.add(stateLabels[i], gc); } }
From source file:org.broad.igv.peaks.PeakTrackMenu.java
private void init(final TrackClickEvent trackClickEvent) { Collection<Track> tracks = IGV.getInstance().getSelectedTracks(); //Arrays.asList(new Track[] {track}); //Title//from w ww.j ava 2 s . com JLabel popupTitle = new JLabel("<html><b>" + track.getName(), JLabel.LEFT); Font newFont = getFont().deriveFont(Font.BOLD, 12); popupTitle.setFont(newFont); add(popupTitle); addSeparator(); add(TrackMenuUtils.getTrackRenameItem(tracks)); add(TrackMenuUtils.getChangeTrackHeightItem(tracks)); add(TrackMenuUtils.getChangeFontSizeItem(tracks)); //Change Track Settings addDisplayModeItems(); addSeparator(); JMenuItem plotItem = new JMenuItem("Open Trend Plot..."); plotItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { openTimeSeriesPlot(trackClickEvent); } }); add(plotItem); if (track.isShowSignals()) { add(TrackMenuUtils.getDataRangeItem(tracks)); add(TrackMenuUtils.getLogScaleItem(tracks)); add(TrackMenuUtils.getShowDataRangeItem(tracks)); } addSeparator(); add(TrackMenuUtils.getRemoveMenuItem(tracks)); }
From source file:MultiLineLabel.java
public void addText(String text, int size) { if (spacing > 0) add(Box.createVerticalStrut(spacing)); String strs[] = splitLines(text); JLabel l; Font font = new Font("SansSerif", fontAttributes, size); for (int i = 0; strs != null && i < strs.length; i++) { l = new JLabel(strs[i]); l.setFont(font); l.setAlignmentX(alignment);//w ww.j a v a 2 s. co m if (col != null) l.setForeground(col); add(l); } }
From source file:be.tutul.naheulcraft.launcher.auth.LogInForm.java
private void createInterface() { setLayout(new GridBagLayout()); GridBagConstraints constraints = new GridBagConstraints(); constraints.fill = 2;/*from ww w. ja v a 2 s. c om*/ constraints.gridx = 0; constraints.gridy = -1; constraints.weightx = 1.0D; add(Box.createGlue()); JLabel usernameLabel = new JLabel("Pseudo : "); Font labelFont = usernameLabel.getFont().deriveFont(1); Font smalltextFont = usernameLabel.getFont().deriveFont(labelFont.getSize() - 2.0F); usernameLabel.setFont(labelFont); add(usernameLabel, constraints); add(this.usernameField, constraints); add(Box.createVerticalStrut(10), constraints); JLabel passwordLabel = new JLabel("Mot de passe :"); passwordLabel.setFont(labelFont); add(passwordLabel, constraints); add(this.passwordField, constraints); JLabel forgotPasswordLabel = new JLabel("(oubli ?)"); forgotPasswordLabel.setCursor(new Cursor(12)); forgotPasswordLabel.setFont(smalltextFont); forgotPasswordLabel.setHorizontalAlignment(4); forgotPasswordLabel.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { try { Util.openLink(Variables.lost); } catch (Exception e1) { LogInForm.this.login.getLauncher().getLogger() .error("Impossible d'ouvrir le lien pour les logins oublis"); JOptionPane.showMessageDialog(LogInForm.this.login.getLauncher().getPanel(), "Impossible d'ouvrir la page\nRendez-vous sur le site de NaheulCraft pour rcuprer vos identifiants", "Impossible d'ouvrir l'URL", 0); } } }); add(forgotPasswordLabel, constraints); createUserDropdownPanel(labelFont); add(this.userDropdownPanel, constraints); add(Box.createVerticalStrut(10), constraints); }
From source file:es.emergya.ui.plugins.forms.FormGeneric.java
protected void generateTitle() { title = new JPanel(new FlowLayout(FlowLayout.LEADING)); final JLabel labelTitle = new JLabel(this.getTitle(), this.getIcon(), JLabel.LEFT); labelTitle.setFont(LogicConstants.deriveBoldFont(12f)); title.setBackground(Color.WHITE); title.add(labelTitle);/* w w w. j ava 2s .c om*/ }
From source file:Visuals.RingChart.java
public JPanel addAVCharts() { JPanel thisPanel = new JPanel(); thisPanel.setLayout(new BorderLayout()); int tempCriticalCount = 0, tempUpdatedCount = 0; String[][] criticalList = new String[critical][4]; String[][] updatedList = new String[low][4]; for (int i = 0; i < riskCount; i++) { if (risks[i][2].equals("Critical")) { criticalList[tempCriticalCount][0] = risks[i][0]; criticalList[tempCriticalCount][1] = risks[i][1]; criticalList[tempCriticalCount][3] = risks[i][3]; tempCriticalCount++;/*ww w . ja v a 2 s . c o m*/ } if (risks[i][2].equals("Low")) { updatedList[tempUpdatedCount][0] = risks[i][0]; updatedList[tempUpdatedCount][1] = risks[i][1]; tempUpdatedCount++; } } JTable criticalTable = new JTable(criticalList, criticalColumns); JTable updatedTable = new JTable(updatedList, updatedColumns); TableColumn tcol = criticalTable.getColumnModel().getColumn(2); criticalTable.removeColumn(tcol); TableColumn tcol2 = updatedTable.getColumnModel().getColumn(2); updatedTable.removeColumn(tcol2); criticalTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); updatedTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); criticalTable.setEnabled(false); updatedTable.setEnabled(false); int width = 0; for (int i = 0; i < 3; i++) { for (int row = 0; row < criticalTable.getRowCount(); row++) { TableCellRenderer renderer = criticalTable.getCellRenderer(row, i); Component comp = criticalTable.prepareRenderer(renderer, row, i); width = Math.max(comp.getPreferredSize().width, width); } criticalTable.getColumnModel().getColumn(i).setPreferredWidth(width); width = 0; } for (int i = 0; i < 2; i++) { for (int row = 0; row < updatedTable.getRowCount(); row++) { TableCellRenderer renderer = updatedTable.getCellRenderer(row, i); Component comp = updatedTable.prepareRenderer(renderer, row, i); width = Math.max(comp.getPreferredSize().width, width); } updatedTable.getColumnModel().getColumn(i).setPreferredWidth(width); width = 0; } criticalTable.setShowHorizontalLines(true); criticalTable.setRowHeight(40); updatedTable.setShowHorizontalLines(true); updatedTable.setRowHeight(40); JScrollPane criticalTableScrollPane = new JScrollPane(criticalTable, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); JScrollPane updatedTableScrollPane = new JScrollPane(updatedTable, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); Dimension d = criticalTable.getPreferredSize(); criticalTableScrollPane.setPreferredSize( new Dimension((d.width - 400), (criticalTable.getRowHeight() + 1) * (tempCriticalCount + 1))); Dimension d2 = updatedTable.getPreferredSize(); updatedTableScrollPane.setPreferredSize( new Dimension((d.width - 400), (updatedTable.getRowHeight() + 1) * (tempUpdatedCount + 1))); Font titleFonts = new Font("Calibri", Font.BOLD, 30); JLabel criticalLabel = new JLabel(" Critical "); criticalLabel.setFont(titleFonts); criticalLabel.setForeground(new Color(230, 27, 27)); JPanel leftPanel = new JPanel(); leftPanel.setLayout(new BorderLayout()); leftPanel.add(criticalLabel, BorderLayout.WEST); leftPanel.add(criticalTableScrollPane, BorderLayout.CENTER); JLabel updatedLabel = new JLabel(" Updated "); updatedLabel.setFont(titleFonts); updatedLabel.setForeground(new Color(47, 196, 6)); JPanel rightPanel = new JPanel(); rightPanel.setLayout(new BorderLayout()); rightPanel.add(updatedLabel, BorderLayout.WEST); rightPanel.add(updatedTableScrollPane, BorderLayout.CENTER); if (tempCriticalCount != 0) thisPanel.add(leftPanel, BorderLayout.NORTH); if (tempUpdatedCount != 0) thisPanel.add(rightPanel, BorderLayout.SOUTH); return thisPanel; }