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

How to use
JButton
in
javax.swing

Best Java code snippets using javax.swing.JButton (Showing top 20 results out of 13,122)

Refine searchRefine arrow

  • Container
  • JFrame
  • Window
  • JPanel
  • AbstractButton
origin: skylot/jadx

String name = node.makeLongString();
final JPanel panel = new JPanel(new FlowLayout(FlowLayout.CENTER, 3, 0));
panel.setOpaque(false);
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.setUI(new BasicButtonUI());
button.setContentAreaFilled(false);
button.setFocusable(false);
button.setBorder(null);
button.setBorderPainted(false);
button.addActionListener(e -> closeCodePanel(contentPanel));
panel.addMouseListener(new MouseAdapter() {
  @Override
  public void mouseClicked(MouseEvent e) {
origin: stanfordnlp/CoreNLP

private void setTsurgeonState(boolean running) {
 cancelTsurgeon.setEnabled(running);
 runScript.setEnabled(!running);
 findMatches.setEnabled(!running);
 browseButton.setEnabled(!running);
}
origin: spotbugs/spotbugs

  public static void main(String args[]) {
    JFrame frame = new JFrame();
    frame.setTitle("Title");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JButton button = new JButton();
    button.setText("Hello, World!");
    frame.getContentPane().add(button, BorderLayout.CENTER);
    frame.setSize(200, 100);
    frame.pack();
    frame.setVisible(true);
    frame.show();
  }
}
origin: stackoverflow.com

 JButton button = new JButton("Do Something");
button.addActionListener( action );
origin: wiztools/rest-client

@Override
public void setAsIdle() {
  jb_request.setIcon(icon_go);
  jb_request.setToolTipText(TEXT_GO);
}
origin: marytts/marytts

private void toggleStopToRecord() {
  jButton_Record.setEnabled(true);
  jButton_Record.setText("Record");
  jButton_Record.setIcon(IconSet.REC_16X16);
  this.playingStatus = false;
}
origin: wildfly/wildfly

public void go() throws Exception {
  if(!no_channel && !use_state)
    channel.connect(cluster_name);
  mainFrame=new JFrame();
  mainFrame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
  panel=new DrawPanel(use_state);
  panel.setBackground(background_color);
  sub_panel=new JPanel();
  mainFrame.getContentPane().add("Center", panel);
  clear_button=new JButton("Clear");
  clear_button.setFont(default_font);
  clear_button.addActionListener(this);
  leave_button=new JButton("Leave");
  leave_button.setFont(default_font);
  leave_button.addActionListener(this);
  sub_panel.add("South", clear_button);
  sub_panel.add("South", leave_button);
  mainFrame.getContentPane().add("South", sub_panel);
  mainFrame.setBackground(background_color);
  clear_button.setForeground(Color.blue);
  leave_button.setForeground(Color.blue);
  mainFrame.pack();
  mainFrame.setLocation(15, 25);
  mainFrame.setBounds(new Rectangle(250, 250));
  if(!no_channel && use_state) {
    channel.connect(cluster_name, null, state_timeout);
  }
  mainFrame.setVisible(true);
  setTitle();
}
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,
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() {
    public void actionPerformed (ActionEvent evt) {
      setVisible(false);
origin: skylot/jadx

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: apache/shiro

updateValueLabel();
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);
secureMethod1Button = new JButton("Method #1");
secureMethod1Button.addActionListener(this);
secureMethod2Button = new JButton("Method #2");
secureMethod2Button.addActionListener(this);
secureMethod3Button = new JButton("Method #3");
secureMethod3Button.addActionListener(this);
JPanel methodPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
methodPanel.add(secureMethod3Button);
frame = new JFrame("Apache Shiro Sample Application");
frame.setSize(500, 200);
origin: log4j/log4j

public LogFactor5ErrorDialog(JFrame jframe, String message) {
 super(jframe, "Error", true);
 JButton ok = new JButton("Ok");
 ok.addActionListener(new ActionListener() {
  public void actionPerformed(ActionEvent e) {
   hide();
  }
 });
 JPanel bottom = new JPanel();
 bottom.setLayout(new FlowLayout());
 bottom.add(ok);
 JPanel main = new JPanel();
 main.setLayout(new GridBagLayout());
 wrapStringOnPanel(message, main);
 getContentPane().add(main, BorderLayout.CENTER);
 getContentPane().add(bottom, BorderLayout.SOUTH);
 show();
}
//--------------------------------------------------------------------------
origin: stackoverflow.com

final JFrame frame = new JFrame("Display Mode");
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
frame.setUndecorated(true);
JButton btn1 = new JButton("Full-Screen");
btn1.addActionListener(new ActionListener() {
  @Override
  public void actionPerformed(ActionEvent e) {
JButton btn2 = new JButton("Normal");
btn2.addActionListener(new ActionListener() {
  @Override
  public void actionPerformed(ActionEvent e) {
JPanel panel = new JPanel(new FlowLayout(FlowLayout.CENTER));
panel.add(btn1);
panel.add(btn2);
frame.add(panel);
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: stackoverflow.com

private JSpinner gravitySpinner;
private JPanel mainPanel = new JPanel();
 mainPanel.setLayout(new BorderLayout());
 draw = new DrawingArea();
 mainPanel.add(draw, BorderLayout.CENTER);
 userInt = new JPanel();
 mainPanel.add(userInt, BorderLayout.NORTH);
 b1 = new JButton("Start");
 b2 = new JButton("aaa");
 b1.addActionListener(new ActionListener() {
   @Override
   public void actionPerformed(ActionEvent e) {
 SwingUtilities.invokeLater(new Runnable() {
   public void run() {
    JFrame window = new JFrame("Ball");
    window.add(new StartingPoint().getMainPanel());
    window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    window.pack();
    window.setLocationRelativeTo(null);
    window.setVisible(true);
origin: skylot/jadx

panel.add(makeOtherGroup());
JButton saveBtn = new JButton(NLS.str("preferences.save"));
saveBtn.addActionListener(event -> {
  settings.sync();
  if (needReload) {
JButton cancelButton = new JButton(NLS.str("preferences.cancel"));
cancelButton.addActionListener(event -> {
  JadxSettingsAdapter.fill(settings, startSettings);
  dispose();
});
JButton resetBtn = new JButton(NLS.str("preferences.reset"));
resetBtn.addActionListener(event -> {
  int res = JOptionPane.showConfirmDialog(
      JadxSettingsWindow.this,
    String defaults = JadxSettingsAdapter.makeString(JadxSettings.makeDefault());
    JadxSettingsAdapter.fill(settings, defaults);
    getContentPane().removeAll();
    initUI();
    pack();
contentPane.add(panel, BorderLayout.CENTER);
contentPane.add(buttonPane, BorderLayout.PAGE_END);
getRootPane().setDefaultButton(saveBtn);
origin: stanfordnlp/CoreNLP

private void buildExtractButton() {
 if (extractButton == null) {
  JPanel buttonPanel = new JPanel();
  extractButton = new JButton("Run NER");
  buttonPanel.add(extractButton);
  frame.getContentPane().add(buttonPanel, BorderLayout.SOUTH);
  extractButton.addActionListener(actor);
 }
}
origin: pmd/pmd

private void init() {
  JTextArea errorArea = new JTextArea();
  errorArea.setEditable(false);
  errorArea.setText(exc.getMessage() + "\n");
  getContentPane().setLayout(new BorderLayout());
  JPanel messagePanel = new JPanel(new BorderLayout());
  messagePanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createRaisedBevelBorder(), BorderFactory
      .createTitledBorder(BorderFactory.createEtchedBorder(), NLS.nls("COMPILE_ERROR.PANEL.TITLE"))));
  messagePanel.add(new JScrollPane(errorArea), BorderLayout.CENTER);
  getContentPane().add(messagePanel, BorderLayout.CENTER);
  JPanel btnPane = new JPanel(new FlowLayout(FlowLayout.RIGHT));
  okBtn = new JButton(NLS.nls("COMPILE_ERROR.OK_BUTTON.CAPTION"));
  okBtn.addActionListener(this);
  btnPane.add(okBtn);
  getRootPane().setDefaultButton(okBtn);
  getContentPane().add(btnPane, BorderLayout.SOUTH);
  pack();
  setLocationRelativeTo(getParent());
  setVisible(true);
}
origin: skylot/jadx

@NotNull
protected JPanel initButtonsPanel() {
  progressPane = new ProgressPanel(mainWindow, false);
  JButton cancelButton = new JButton(NLS.str("search_dialog.cancel"));
  cancelButton.addActionListener(event -> dispose());
  JButton openBtn = new JButton(NLS.str("search_dialog.open"));
  openBtn.addActionListener(event -> openSelectedItem());
  getRootPane().setDefaultButton(openBtn);
  JPanel buttonPane = new JPanel();
  buttonPane.setLayout(new BoxLayout(buttonPane, BoxLayout.LINE_AXIS));
  buttonPane.setBorder(BorderFactory.createEmptyBorder(0, 10, 10, 10));
  buttonPane.add(progressPane);
  buttonPane.add(Box.createRigidArea(new Dimension(5, 0)));
  buttonPane.add(Box.createHorizontalGlue());
  buttonPane.add(openBtn);
  buttonPane.add(Box.createRigidArea(new Dimension(10, 0)));
  buttonPane.add(cancelButton);
  return buttonPane;
}
origin: skylot/jadx

warnLabel.setVisible(false);
JPanel resultsPanel = new JPanel();
resultsPanel.setLayout(new BoxLayout(resultsPanel, BoxLayout.PAGE_AXIS));
resultsPanel.add(warnLabel);
resultsPanel.add(new JScrollPane(resultsTable,
    ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
resultsInfoLabel = new JLabel("");
JButton nextPageButton = new JButton("->");
nextPageButton.setToolTipText(NLS.str("search_dialog.next_page"));
nextPageButton.addActionListener(e -> {
  if (resultsModel.nextPage()) {
    switchPage(renderer);
JButton prevPageButton = new JButton("<-");
prevPageButton.setToolTipText(NLS.str("search_dialog.prev_page"));
prevPageButton.addActionListener(e -> {
  if (resultsModel.prevPage()) {
    switchPage(renderer);
origin: stanfordnlp/CoreNLP

private void buildExtractButton() {
 if (extractButton == null) {
  JPanel buttonPanel = new JPanel();
  extractButton = new JButton("Extract");
  buttonPanel.add(extractButton);
  frame.add(buttonPanel, BorderLayout.SOUTH);
  extractButton.addActionListener(actor);
 }
}
javax.swingJButton

Most used methods

  • <init>
  • addActionListener
  • setEnabled
  • setText
  • setToolTipText
  • setIcon
  • setPreferredSize
  • setActionCommand
  • setVisible
  • setBorder
  • setMargin
  • setFocusable
  • setMargin,
  • setFocusable,
  • setBackground,
  • setFont,
  • setBorderPainted,
  • getPreferredSize,
  • setMnemonic,
  • doClick,
  • isEnabled,
  • setName

Popular in Java

  • Reactive rest calls using spring rest template
  • putExtra (Intent)
  • addToBackStack (FragmentTransaction)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • GridLayout (java.awt)
    The GridLayout class is a layout manager that lays out a container's components in a rectangular gri
  • Calendar (java.util)
    Calendar is an abstract base class for converting between a Date object and a set of integer fields
  • Callable (java.util.concurrent)
    A task that returns a result and may throw an exception. Implementors define a single method with no
  • ConcurrentHashMap (java.util.concurrent)
    A plug-in replacement for JDK1.5 java.util.concurrent.ConcurrentHashMap. This version is based on or
  • Handler (java.util.logging)
    A Handler object accepts a logging request and exports the desired messages to a target, for example
  • JPanel (javax.swing)
  • Top PhpStorm 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