About 9,670,000 results
Open links in new tab
  1. java - change JPanel after clicking on a button - Stack Overflow

    Jun 11, 2012 · Clicking on one of the buttons should change the view in this JFrame. my button definition. JButton btnStart = new JButton("Start"); btnStart.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { }); btnStart.setBounds(10, 11, 110, 23); contentPane.add(btnStart); // edit.

  2. Open new screen or page on button click (java-eclipse)

    Jun 10, 2014 · with your current implementation, when you open newticketwindow, just close the previous window programatically. or you can make two separate panels and add them to a frame, and change these panels on button click.

  3. Java GUI switching between panels on button click

    Mar 27, 2021 · I want to have a single frame application that can switch between frames on a button click. I created a frame and added three panels P1-P3. These are set as Card Layout (from what i read from forums). Then I added additional panels to these to which i have set colour and buttons. ''' private JPanel P1; private JPanel P2; private JPanel P3;

  4. Switching JPanel when clicking on a JButton (Swing) : r/java - Reddit

    Dec 7, 2014 · I have one MainFrame and I need to switch from the Main JPanel to another JPanel when I click on the button. MainFrame code: /** */ private static final long serialVersionUID = 1L; private JFrame myFrame; private JPanel contentPane; /** * Launch the application. */ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() {

  5. java - How to switch screens when a button is pressed? LibGDX

    Dec 19, 2016 · Then when you need to change to a different screen, you call Game's setScreen() method to change to a new screen. If you find that setScreen() doesn't do what you want, you can use the same pattern but create your own version of the setScreen() method.

  6. Java Button Click Event Tutorial - JButton ActionListener

    Learn Java Button Click Event in Java swing and JButton ActionListener using the JFrame of Java swing. JFrame Button Click Event. Swing JButton click action

  7. How to change the layout on button click in Java using javafx

    This tutorial shows you how to change the layout on button click in Java using javafx. To change the layout on a button click in Java using JavaFX, you can create multiple layouts (e.g., VBox, HBox, GridPane, etc.) and then switch between them when the button is clicked. Here's a step-by-step guide to achieving this:

  8. Java AWT Button - GeeksforGeeks

    Nov 26, 2023 · Java AWT Buttons can be used to perform several actions like saving a file, closing a window, submitting a form, or triggering any specific action. When we press a button, AWT creates an instance of ActionEvent and delivers it by calling processEvent on the button.

  9. JAVA - Open New Window with a Button Click in Eclipse

    Jun 23, 2018 · JAVA - Open New Window with a Button Click in Eclipse Hello everyone and welcome to my next tutorial, today I will show you how to open a new widow (JFrame) with the click of a button. And...

  10. java - How will I change the contents of the panel with a click of a ...

    Apr 3, 2013 · Steps to achive this: 1.Create a main panel and add to JFrame 2. Add the contents to a welcomePanel in a main JPanel. 3. Once the user presses "start" button in the welcomePanel. call removeAll() on the main Container. 4.Add new contents in a contentPanel in main JPanel and call revalidate() which will update main.

Refresh