Tabnine Logo
JLabel
Code IndexAdd Tabnine to your IDE (free)

How to use
JLabel
in
javax.swing

Best Java code snippets using javax.swing.JLabel (Showing top 20 results out of 14,751)

Refine searchRefine arrow

  • Container
  • JFrame
  • Window
  • JPanel
  • JButton
  • JComponent
origin: log4j/log4j

protected JPanel createStatusArea() {
 JPanel statusArea = new JPanel();
 JLabel status =
   new JLabel("No log records to display.");
 _statusLabel = status;
 status.setHorizontalAlignment(JLabel.LEFT);
 statusArea.setBorder(BorderFactory.createEtchedBorder());
 statusArea.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
 statusArea.add(status);
 return (statusArea);
}
origin: iluwatar/java-design-patterns

private void setup() {
 setLayout(new BorderLayout());
 JPanel panel = new JPanel();
 add(jl, BorderLayout.SOUTH);
 add(panel, BorderLayout.CENTER);
 panel.setLayout(new GridLayout(6, 2));
 panel.add(new JLabel("Name"));
 panel.add(jtFields[0]);
 panel.add(new JLabel("Contact Number"));
 panel.add(jtFields[1]);
 panel.add(new JLabel("Address"));
 panel.add(jtAreas[0]);
 panel.add(new JLabel("Deposit Number"));
 panel.add(jtFields[2]);
 panel.add(new JLabel("Order"));
 panel.add(jtAreas[1]);
 panel.add(clearButton);
 panel.add(processButton);
 clearButton.addActionListener(e -> {
  for (JTextArea i : jtAreas) {
   i.setText("");
 processButton.addActionListener(e -> {
  Order order = new Order(jtFields[0].getText(), jtFields[1].getText(), jtAreas[0].getText(), jtFields[2].getText(),
    jtAreas[1].getText());
  jl.setText(sendRequest(order));
 });
origin: runelite/runelite

private JPanel buildPingField()
{
  JPanel column = new JPanel(new BorderLayout());
  column.setBorder(new EmptyBorder(0, 5, 0, 5));
  pingField = new JLabel("-");
  pingField.setFont(FontManager.getRunescapeSmallFont());
  column.add(pingField, BorderLayout.EAST);
  return column;
}
origin: gocd/gocd

private JLabel label(String content, Font font) {
  JLabel jLabel = new JLabel(content);
  jLabel.setHorizontalAlignment(JLabel.CENTER);
  if (font != null) {
    jLabel.setFont(font);
  }
  return jLabel;
}
origin: runelite/runelite

@Override
public void mouseEntered(MouseEvent mouseEvent)
{
  textLabel.setForeground(HIGHLIGHT_COLOR);
  if (!ordering)
  {
    arrowLabel.setIcon(HIGHLIGHT_ARROW_UP);
  }
}
origin: libgdx/libgdx

  ((JSpinner.DefaultEditor)((JSpinner)component).getEditor()).getTextField().setColumns(4);
JPanel panel = new JPanel();
getContentPane().add(
  panel,
  new GridBagConstraints(0, 1, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(5, 5, 0,
    5), 0, 0));
panel.add(new JLabel(name + ":"));
panel.add(component);
JPanel buttonPanel = new JPanel();
getContentPane().add(
  buttonPanel,
  new GridBagConstraints(0, 2, 2, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE,
    new Insets(0, 0, 0, 0), 0, 0));
  JButton okButton = new JButton("OK");
  buttonPanel.add(okButton);
  okButton.addActionListener(new ActionListener() {
    public void actionPerformed (ActionEvent evt) {
      okPressed = true;
  JButton cancelButton = new JButton("Cancel");
  buttonPanel.add(cancelButton);
  cancelButton.addActionListener(new ActionListener() {
origin: apache/shiro

public void afterPropertiesSet() throws Exception {
  ClassPathResource resource = new ClassPathResource("logo.png");
  ImageIcon icon = new ImageIcon(resource.getURL());
  JLabel logo = new JLabel(icon);
  saveButton = new JButton("Save Value");
  saveButton.addActionListener(this);
  refreshButton = new JButton("Refresh Value");
  refreshButton.addActionListener(this);
  JPanel valuePanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
  valuePanel.add(valueField);
  valuePanel.add(saveButton);
  valuePanel.add(refreshButton);
  methodPanel.add(secureMethod3Button);
  frame = new JFrame("Apache Shiro Sample Application");
  frame.setSize(500, 200);
  Container panel = frame.getContentPane();
  panel.setLayout(new BorderLayout());
  panel.add(logo, BorderLayout.NORTH);
  panel.add(valuePanel, BorderLayout.CENTER);
  panel.add(methodPanel, BorderLayout.SOUTH);
origin: skylot/jadx

public final void initUI() {
  Font font = new Font("Serif", Font.BOLD, 13);
  JLabel name = new JLabel("jadx");
  name.setFont(font);
  name.setAlignmentX(0.5f);
  JLabel desc = new JLabel("Dex to Java decompiler");
  desc.setFont(font);
  desc.setAlignmentX(0.5f);
  JLabel version = new JLabel("version: " + JadxDecompiler.getVersion());
  version.setFont(font);
  version.setAlignmentX(0.5f);
  JPanel textPane = new JPanel();
  textPane.setBorder(BorderFactory.createEmptyBorder(15, 15, 15, 15));
  textPane.setLayout(new BoxLayout(textPane, BoxLayout.PAGE_AXIS));
  textPane.add(Box.createRigidArea(new Dimension(0, 10)));
  textPane.add(name);
  textPane.add(Box.createRigidArea(new Dimension(0, 20)));
  JButton close = new JButton(NLS.str("tabs.close"));
  close.addActionListener(event -> dispose());
  close.setAlignmentX(0.5f);
  contentPane.add(textPane, BorderLayout.CENTER);
  contentPane.add(close, BorderLayout.PAGE_END);
origin: skylot/jadx

String name = node.makeLongString();
final JPanel panel = new JPanel(new FlowLayout(FlowLayout.CENTER, 3, 0));
panel.setOpaque(false);
final JLabel label = new JLabel(name);
label.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 10));
label.setIcon(node.getIcon());
final JButton button = new JButton();
button.setIcon(ICON_CLOSE_INACTIVE);
button.setRolloverIcon(ICON_CLOSE);
button.setRolloverEnabled(true);
button.setOpaque(false);
button.addActionListener(e -> closeCodePanel(contentPanel));
panel.addMouseListener(new MouseAdapter() {
  @Override
  public void mouseClicked(MouseEvent e) {
origin: stackoverflow.com

 JFrame frame = new JFrame();
frame.setLayout(new BorderLayout());
frame.setSize(200, 200);

// create the status bar panel and shove it down the bottom of the frame
JPanel statusPanel = new JPanel();
statusPanel.setBorder(new BevelBorder(BevelBorder.LOWERED));
frame.add(statusPanel, BorderLayout.SOUTH);
statusPanel.setPreferredSize(new Dimension(frame.getWidth(), 16));
statusPanel.setLayout(new BoxLayout(statusPanel, BoxLayout.X_AXIS));
JLabel statusLabel = new JLabel("status");
statusLabel.setHorizontalAlignment(SwingConstants.LEFT);
statusPanel.add(statusLabel);

frame.setVisible(true);
origin: stackoverflow.com

 public static void main(String args[]){
  JFrame f = new JFrame();
  f.setLayout(new BorderLayout());
  final JPanel p = new JPanel();
  p.add(new JLabel("A Panel"));
  f.add(p, BorderLayout.CENTER);

  //create a button which will hide the panel when clicked.
  JButton b = new JButton("HIDE");
  b.addActionListener(new ActionListener(){
    public void actionPerformed(ActionEvent e){
        p.setVisible(false);
    }
  });

  f.add(b,BorderLayout.SOUTH);
  f.pack();
  f.setVisible(true);
}
origin: skylot/jadx

  private void initUI() {
    JLabel lbl = new JLabel(NLS.str("usage_dialog.label"));
    JLabel nodeLabel = new JLabel(this.node.makeLongString(), this.node.getIcon(), SwingConstants.LEFT);
    lbl.setLabelFor(nodeLabel);

    JPanel searchPane = new JPanel();
    searchPane.setLayout(new FlowLayout(FlowLayout.LEFT));
    searchPane.add(lbl);
    searchPane.add(nodeLabel);
    searchPane.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));

    initCommon();
    JPanel resultsPanel = initResultsTable();
    JPanel buttonPane = initButtonsPanel();

    Container contentPane = getContentPane();
    contentPane.add(searchPane, BorderLayout.PAGE_START);
    contentPane.add(resultsPanel, BorderLayout.CENTER);
    contentPane.add(buttonPane, BorderLayout.PAGE_END);

    setTitle(NLS.str("usage_dialog.title"));
    pack();
    setSize(800, 500);
    setLocationRelativeTo(null);
    setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    setModalityType(ModalityType.MODELESS);
  }
}
origin: stanfordnlp/CoreNLP

private JPanel makeFoundStatsBox() {
 JPanel foundStatsBox = new JPanel();
 foundStatsBox.setLayout(new GridBagLayout());
 Box labelBox = Box.createHorizontalBox();
 foundStats = new JLabel(" ");
 labelBox.add(foundStats);
 historyButton = new JButton("Statistics");
 historyButton.setEnabled(false);
 historyButton.addActionListener(this);
 GridBagConstraints c = new GridBagConstraints();
 c.fill = GridBagConstraints.BOTH;
 c.weightx = 1.7;
 foundStatsBox.add(labelBox,c);
 c.weightx = .3;
 c.gridwidth = 1;
 foundStatsBox.add(historyButton);
 return foundStatsBox;
}
origin: skylot/jadx

textPane.setBorder(BorderFactory.createEmptyBorder(15, 15, 15, 15));
JPanel controlPane = new JPanel();
controlPane.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
final JComboBox<Level> cb = new JComboBox<>(LEVEL_ITEMS);
cb.setSelectedItem(level);
  registerLogListener();
});
JLabel levelLabel = new JLabel(NLS.str("log_viewer.log_level"));
levelLabel.setLabelFor(cb);
controlPane.add(levelLabel);
controlPane.add(cb);
JButton close = new JButton(NLS.str("tabs.close"));
close.addActionListener(event -> close());
close.setAlignmentX(0.5f);
contentPane.add(controlPane, BorderLayout.PAGE_START);
contentPane.add(scrollPane, BorderLayout.CENTER);
contentPane.add(close, BorderLayout.PAGE_END);
origin: log4j/log4j

super(jframe, title, true);
JPanel bottom = new JPanel();
bottom.setLayout(new FlowLayout());
JPanel main = new JPanel();
main.setLayout(new FlowLayout());
main.add(new JLabel(label));
_textField = new JTextField(size);
main.add(_textField);
JButton ok = new JButton("Ok");
ok.addActionListener(new ActionListener() {
 public void actionPerformed(ActionEvent e) {
  hide();
JButton cancel = new JButton("Cancel");
cancel.addActionListener(new ActionListener() {
 public void actionPerformed(ActionEvent e) {
bottom.add(ok);
bottom.add(cancel);
getContentPane().add(main, BorderLayout.CENTER);
getContentPane().add(bottom, BorderLayout.SOUTH);
pack();
centerWindow(this);
origin: stackoverflow.com

 public static void main(String[] args) {
  JFrame frame = new JFrame();
  frame.setLayout(new GridBagLayout());
  JPanel panel = new JPanel();
  panel.add(new JLabel("This is a label"));
  panel.setBorder(new LineBorder(Color.BLACK)); // make it easy to see
  frame.add(panel, new GridBagConstraints());
  frame.setSize(400, 400);
  frame.setLocationRelativeTo(null);
  frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  frame.setVisible(true);
}
origin: stanfordnlp/CoreNLP

private JPanel makeBrowseButtonBox() {
 JPanel buttonBox = new JPanel();
 buttonBox.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
 buttonBox.setLayout(new GridBagLayout());
 browseButton = new JButton("Browse Trees");
 browseButton.addActionListener(this);
 JLabel sizeLabel = new JLabel("Tree size:");
 JSlider fontSlider = new JSlider(2, 64, 12);
 fontSlider.addChangeListener(this);
 GridBagConstraints buttonConstraints = new GridBagConstraints();
 buttonConstraints.fill = GridBagConstraints.HORIZONTAL;
 buttonConstraints.weightx = 0.2;
 buttonConstraints.weighty = 0.2;
 buttonBox.add(browseButton,buttonConstraints);
 buttonConstraints.weightx = 0.6;
 buttonBox.add(fontSlider, buttonConstraints);
 buttonConstraints.weightx = 0.2;
 buttonBox.add(sizeLabel, buttonConstraints);
 return buttonBox;
}
origin: stackoverflow.com

JFrame frame = new JFrame();
frame.setTitle("Welcome!");
frame.setSize(520, 480);
frame.setLocationRelativeTo(null);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanel heroShotPanel = new JPanel();
JLabel heroShot = new JLabel(heroShotImage);
heroShotPanel.add(heroShot);
JPanel submitPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
JButton start = new JButton("Start");
start.setToolTipText("Click to use library");
submitPanel.add(start);
frame.getContentPane().add(heroShotPanel, BorderLayout.NORTH);
frame.getContentPane().add(submitPanel, BorderLayout.SOUTH);
frame.setVisible(true);
frame.getRootPane().setDefaultButton(start);
start.requestFocus();
origin: stackoverflow.com

final JFrame frame = new JFrame("Nested Layout Example");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
final JPanel gui = new JPanel(new BorderLayout(5,5));
gui.setBorder( new TitledBorder("BorderLayout(5,5)") );
plafComponents.add(plafChooser);
plafComponents.add(pack);
gui.add(plafComponents, BorderLayout.NORTH);
JPanel dynamicLabels = new JPanel(new BorderLayout(4,4));
dynamicLabels.setBorder(
  new TitledBorder("GridLayout(0,2,3,3)") );
JButton addNew = new JButton("Add Another Label");
    labels.add( new JLabel("Label " + ++labelCount) );
g.fillRect(0,0,200,200);
ImageIcon ii = new ImageIcon(bi);
JLabel imageLabel = new JLabel(ii);
frame.setContentPane(gui);
frame.pack();
origin: ballerina-platform/ballerina-lang

rootPanel = new JPanel();
rootPanel.setLayout(new GridLayoutManager(9, 4, new Insets(5, 5, 0, 0), -1, -1));
final Spacer spacer1 = new Spacer();
rootPanel.add(spacer1, new GridConstraints(2, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
final JLabel label1 = new JLabel();
Font label1Font = this.$$$getFont$$$(null, Font.BOLD, 20, label1.getFont());
if (label1Font != null) label1.setFont(label1Font);
label1.setText("Miscellaneous Settings");
rootPanel.add(label1, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
final Spacer spacer2 = new Spacer();
rootPanel.add(spacer2, new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
resetCustomAssociationsButton = new JButton();
resetCustomAssociationsButton.setText("Reset custom associations");
rootPanel.add(resetCustomAssociationsButton, new GridConstraints(7, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
alwaysSendRequestsCheckBox.setMargin(new Insets(2, 2, 2, 2));
alwaysSendRequestsCheckBox.setText("Always send requests");
alwaysSendRequestsCheckBox.setToolTipText("Send requests even if a language plugin already supports it");
rootPanel.add(alwaysSendRequestsCheckBox, new GridConstraints(7, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 1, false));
javax.swingJLabel

Most used methods

  • <init>
  • setText
  • setFont
  • setIcon
  • setForeground
  • setHorizontalAlignment
  • setBorder
  • getFont
  • setLabelFor
  • setToolTipText
  • getText
  • setVisible
  • getText,
  • setVisible,
  • setBackground,
  • setOpaque,
  • setEnabled,
  • setPreferredSize,
  • addMouseListener,
  • getPreferredSize,
  • setVerticalAlignment,
  • setAlignmentX

Popular in Java

  • Reading from database using SQL prepared statement
  • getContentResolver (Context)
  • getExternalFilesDir (Context)
  • getSupportFragmentManager (FragmentActivity)
  • VirtualMachine (com.sun.tools.attach)
    A Java virtual machine. A VirtualMachine represents a Java virtual machine to which this Java vir
  • BufferedInputStream (java.io)
    A BufferedInputStream adds functionality to another input stream-namely, the ability to buffer the i
  • FileOutputStream (java.io)
    An output stream that writes bytes to a file. If the output file exists, it can be replaced or appen
  • ImageIO (javax.imageio)
  • Get (org.apache.hadoop.hbase.client)
    Used to perform Get operations on a single row. To get everything for a row, instantiate a Get objec
  • Runner (org.openjdk.jmh.runner)
  • Best IntelliJ plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now