Frame « Button « Java Swing Q&A





1. Button whith show counter and switch anoter frame after 60 second    stackoverflow.com

hello friends how to create counter button in swing i am using code to switch the frame after 30 second but it will not display 30 second so how to do ...

2. After executing only one button, the frame closes    stackoverflow.com

import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.FileNotFoundException;
import java.io.IOException;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JTextArea;

public class Main {

    private static void createAndShowGUI()  {

        JFrame frame1 = ...

3. Cannot close frame using button after opening a new one in swing    stackoverflow.com

package bt;

import java.awt.Color;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.BorderFactory;
import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPasswordField;
import javax.swing.JTextField;
import javax.swing.SwingUtilities;


public class login extends javax.swing.JFrame implements ActionListener, javax.swing.RootPaneContainer  {

private static final long serialVersionUID ...

6. Urgent - controlling frame restore/maximize button    coderanch.com

hello, the problem i'm having is; is there a way i can set a frames "restore/maximum" button. i am running an applet that creates a frame that the user can resize. i have added an "actual size" checkbox to set the size of the frame to the preferred size of the component. the trouble i'm having is, if the frame is ...

7. Frame without M&M buttons    coderanch.com

8. Frame with no maximize button    coderanch.com





10. How to switch frame use JButton?    coderanch.com

You can move some of the logic into a special class, often called a controller. class Controller { FrameA framea; FrameB frameb; // Constructor public Controller() { framea = new FrameA(this); frameb = new FrameB(this); framea.setVisible(true); frameb.setVisible(false); } public void showFrameB() { frameb.setVisible(true); framea.setVisible(false); } public void showFrameA() { etc ... } } class FrameA { Controller controller = null; public ...

11. How to switch frame use JButton?    coderanch.com

12. Listening frames vs. listening buttons    coderanch.com

The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - ...

15. Button globa the frame all!    coderanch.com

16. How do I close a frame with a button?    java-forums.org

I built a GUI that creates a frame with a bunch of buttons, lists, etc. I have all of the components (buttons, lists, comboboxes, etc) working correctly with action listeners. I'm actually only having an issue with the Exit button. I want to have an Exit button that has the same effect as closing the program by hitting the X button ...





17. Creating a button on the tilte bar of my application frame    java-forums.org

Hello, I want to add few buttons on the title bars of different frames of my application, such as a Logout button in home windows's title bar. Please suggest me how can i achieve this and from what thing i have to start for this? Any tutorial or articles can will also help me..... Regards.

18. Main GUI's method to react to alert frame's buttons    java-forums.org

I have a method called checkForm in my GUI class, where when called, an alert frame pops up (called from another class AlertFrame). Depending on what button the user clicks, OK or Cancel, I would like the checkForm method to do an if/else statement, ex. if(OK button was pressed in AlertFrame, do this) else (Cancel button was pressed in AlertFrame, do ...

20. how do i use jbutton for mutiple frames(2frames)??    forums.oracle.com

//setting positions of components for new frame Insets insets = pane.getInsets(); Dimension size = save.getPreferredSize(); save.setBounds(100 , 50 , size.width, size.height); size = save2.getPreferredSize(); save2.setBounds(200 , 50 , size.width, size.height); size = cancel.getPreferredSize(); cancel.setBounds(400 , 50 , size.width, size.height); size = moviename.getPreferredSize(); moviename.setBounds(100 , 100 , size.width, size.height); size = moviename2.getPreferredSize(); moviename2.setBounds(200 , 100 , size.width, size.height); size = director.getPreferredSize(); director.setBounds(100, ...