swing - Java-How to auto move window in Jframe -


I have a little problem with my program: I want to get the auto window running in the timeline I have a code:

  package simpleFrame; Import java.awt. *; Import java.util.TimerTask; Import javax.swing *; Public class Trololo {public static void} {EventQueue.invokeLater (New Runnable) {Public Zero Run} {JFrame frame = new SizedFrame (); frame.setUndecorated (wrong); frame.setTitle ("SizedFrame "); Frame.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE); frame.setVisible (right); println (" about scheduling work. "); New ReminderBeep (5); println (" Task Scheduled. ")}}} ); }} SizedFrame class extends JFrame {public SizedFrame {toolkit kit = Toolkit.getDefaultToolkit (); Dimension Screen Size = Kit.Gate Screen Size (); Int Screenshite = Screenshots height; Int screenWidth = screenSize.width; SetSize (Screenshoot / 2, Screenshite / 2); SetBounds (500,500, screenWidth / 2, screenHeight / 2); }} Class Reminder Bip {Toolkit Toolkit; Java.util.Timer timer; Public Reminder (Int. Second) {toolkit = Toolkit.getDefaultToolkit (); Timer = new java.util.Timer (); Timer Scheduling (new remindtask (), second * 1000); } Class Remindtak TimerTask {SizedFrame window = new SizedFrame ()); Running public () {window.setBounds (9 00,900,500,600); Toolkit.beep (); Println ("OK"); }}}  

I have a timer that works: Is it "OK" command prompt but not moving forward in the window? / How to get work

In your main () method, you create a SizedFrame and it Display. Then you start the timer.

On timer fire, you create another SizedFrame, but you do not display it. Then you set the limit on the non-displayed SizedFrame. The SizeFrame you are displaying is not resizing.


Comments