protected JPanel getFontFamilyPanel() { if (fontNamePanel == null) { fontNamePanel = new JPanel(); fontNamePanel.setLayout(new BorderLayout()); fontNamePanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); fontNamePanel.setPreferredSize(new Dimension(180, 130)); JScrollPane scrollPane = new JScrollPane(getFontFamilyList()); scrollPane.getVerticalScrollBar().setFocusable(false); scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); JPanel p = new JPanel(); p.setLayout(new BorderLayout()); p.add(getFontFamilyTextField(), BorderLayout.NORTH); p.add(scrollPane, BorderLayout.CENTER); JLabel label = new JLabel(("Font Name")); label.setHorizontalAlignment(JLabel.LEFT); label.setHorizontalTextPosition(JLabel.LEFT); label.setLabelFor(getFontFamilyTextField()); label.setDisplayedMnemonic('F'); fontNamePanel.add(label, BorderLayout.NORTH); fontNamePanel.add(p, BorderLayout.CENTER); } return fontNamePanel; }
protected JPanel getFontStylePanel() { if (fontStylePanel == null) { fontStylePanel = new JPanel(); fontStylePanel.setLayout(new BorderLayout()); fontStylePanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); fontStylePanel.setPreferredSize(new Dimension(140, 130)); JScrollPane scrollPane = new JScrollPane(getFontStyleList()); scrollPane.getVerticalScrollBar().setFocusable(false); scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); JPanel p = new JPanel(); p.setLayout(new BorderLayout()); p.add(getFontStyleTextField(), BorderLayout.NORTH); p.add(scrollPane, BorderLayout.CENTER); JLabel label = new JLabel(("Font Style")); label.setHorizontalAlignment(JLabel.LEFT); label.setHorizontalTextPosition(JLabel.LEFT); label.setLabelFor(getFontStyleTextField()); label.setDisplayedMnemonic('Y'); fontStylePanel.add(label, BorderLayout.NORTH); fontStylePanel.add(p, BorderLayout.CENTER); } return fontStylePanel; }
protected JPanel getFontSizePanel() { if (fontSizePanel == null) { fontSizePanel = new JPanel(); fontSizePanel.setLayout(new BorderLayout()); fontSizePanel.setPreferredSize(new Dimension(70, 130)); fontSizePanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); JScrollPane scrollPane = new JScrollPane(getFontSizeList()); scrollPane.getVerticalScrollBar().setFocusable(false); scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); JPanel p = new JPanel(); p.setLayout(new BorderLayout()); p.add(getFontSizeTextField(), BorderLayout.NORTH); p.add(scrollPane, BorderLayout.CENTER); JLabel label = new JLabel(("Font Size")); label.setHorizontalAlignment(JLabel.LEFT); label.setHorizontalTextPosition(JLabel.LEFT); label.setLabelFor(getFontSizeTextField()); label.setDisplayedMnemonic('S'); fontSizePanel.add(label, BorderLayout.NORTH); fontSizePanel.add(p, BorderLayout.CENTER); } return fontSizePanel; }
this.model = model; label.setVerticalTextPosition(JLabel.BOTTOM); label.setHorizontalTextPosition(JLabel.CENTER); this.add(label, BorderLayout.CENTER); this.add(genButtonPanel(), BorderLayout.SOUTH);
jLabel_PromptCount.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); jLabel_PromptCount.setText("1999"); jLabel_PromptCount.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT); jLabel_PromptCount.setPreferredSize(new java.awt.Dimension(64, 64)); jLabel_PromptTotal.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); jLabel_PromptTotal.setText("/ 2012"); jLabel_PromptTotal.setHorizontalTextPosition(javax.swing.SwingConstants.LEFT); jLabel_PromptTotal.setPreferredSize(new java.awt.Dimension(64, 64));
public class MarioListRenderer extends DefaultListCellRenderer { Font font = new Font("helvitica", Font.BOLD, 24); @Override public Component getListCellRendererComponent( JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { JLabel label = (JLabel) super.getListCellRendererComponent( list, value, index, isSelected, cellHasFocus); label.setIcon(imageMap.get((String) value)); label.setHorizontalTextPosition(JLabel.RIGHT); label.setFont(font); return label; } }
private void setTabTitle(int tabIndex, String title, String iconResourceName) { // tab caption with left sided icon // https://stackoverflow.com/questions/1782224/jtabbedpane-icon-on-left-side-of-tabs JLabel lbl = new JLabel(title); Icon icon = new ImageIcon(getClass().getResource(iconResourceName)); lbl.setIcon(icon); lbl.setIconTextGap(5); lbl.setHorizontalTextPosition(SwingConstants.RIGHT); tabsList.setTabComponentAt(tabIndex, lbl); }
list, value, index, isSelected, cellHasFocus); label.setIcon(imageMap.get((String) value)); label.setHorizontalTextPosition(JLabel.RIGHT); label.setFont(font); return label;
list, value, index, isSelected, cellHasFocus); label.setIcon(imageMap.get((String) value)); label.setHorizontalTextPosition(JLabel.RIGHT); label.setFont(font); return label;
jMemUsageLabel.setText("100% Free mem"); jMemUsageLabel.setFocusable(false); jMemUsageLabel.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT); mageToolbar.add(jMemUsageLabel);
label.setHorizontalTextPosition(JLabel.CENTER); label.setVerticalTextPosition(JLabel.BOTTOM); this.add(label);
lblTableImage.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED)); lblTableImage.setFocusable(false); lblTableImage.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); lblTableImage.setOpaque(true); lblTableImage.setRequestFocusEnabled(false);
/** * Initializes the renderer to a horizontal alignment * of <code>CENTER</code> and a horizontal text position * of <code>LEFT</code>. * */ public TinyTableHeaderRenderer() { setHorizontalAlignment(CENTER); setHorizontalTextPosition(LEFT); }
lblURLServerList.setText("URL server list:"); lblURLServerList.setToolTipText(""); lblURLServerList.setHorizontalTextPosition(javax.swing.SwingConstants.LEADING); lblURLServerList.setPreferredSize(new java.awt.Dimension(110, 16)); lblURLServerList.setVerticalTextPosition(javax.swing.SwingConstants.TOP);
JLabel label = new JLabel("Tab1"); label.setHorizontalTextPosition(JLabel.TRAILING); // Set the text position regarding its icon label.setIcon(UIManager.getIcon("OptionPane.informationIcon")); JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.LEFT); tabbedPane.addTab(null, new JPanel()); tabbedPane.setTabComponentAt(0, label); // Here set the custom tab component
public void setHorizontalTextPosition(int _htp) { if((delegate_==this)||(delegate_==null)) super.setHorizontalTextPosition(_htp); else delegate_.setHorizontalTextPosition(_htp); }
public ServiceCellRenderer() { super(); indicator.setHorizontalTextPosition(JLabel.LEFT); indicator.setIconTextGap(0); indicator.setText(" "); indicator.setOpaque(false); rowDescriptor.setOpaque(false); add(indicator, BorderLayout.WEST); add(rowDescriptor, BorderLayout.CENTER); }
public ChatStatePanel(ChatState state, CharSequence nickname) { setLayout(new FlowLayout(FlowLayout.LEFT, 1, 1)); JLabel label = new JLabel( Res.getString( state.name(), nickname.toString() ) ); label.setFont(new Font("Courier New", Font.PLAIN, 9)); label.setForeground(Color.gray); label.setHorizontalTextPosition(JLabel.LEFT); label.setVerticalTextPosition(JLabel.BOTTOM); add( label ); } }
public GridBagLayoutComponentBuilder label(final String text) { newline(); final JLabel label = new JLabel(text + (text.isEmpty() ? "" : ":")); //$NON-NLS-1$ //$NON-NLS-2$ label.setVerticalTextPosition(JLabel.TOP); label.setVerticalAlignment(JLabel.TOP); label.setHorizontalTextPosition(JLabel.LEFT); label.setHorizontalAlignment(JLabel.LEFT); this.components.add(new GridBagLayoutComponent(label, ++this.column, this.row, 1, 1, UNDEFIND_ANCHOR)); return this; }
@Override protected JComponent createRendererComponent() { final JCondition renderer = new JCondition(); final String string = toString(); final JLabel label = ConditionFactory.createConditionLabel(string.substring(0, string.length() - 3)); label.setIcon(STORE.getMindIcon(getIconName()).getIcon()); label.setHorizontalTextPosition(SwingConstants.LEFT); renderer.add(label); return renderer; }