Time « Development « Java Swing Q&A





1. Why does my swing GUI look different in design than at run-time?    stackoverflow.com

When I design my GUI using swing, the Swing Control Buttons are grey and the text easily fits on them. However, when I run the program the buttons become partly blue ...

2. Reusing Swing components which are time-consuming to initialize    stackoverflow.com

If I have a massive Swing component in my application which takes a long time to initialize, and want to display this component in different places in my GUI at the ...

3. How to discover user doesn't operate the Swing app for some time    stackoverflow.com

We have a Swing application, currently I need to add a feature that is to do some jobs when user doesn't operate the application for some time (e.g. 5 minutes). I ...

4. Swing time picker    stackoverflow.com

Im looking for a pretty and decent time picker component. There are a lot of alternatives for date picking on Swing but no for time. I've seen nice Date/Time components picking on ...

5. setting Time limit    coderanch.com

Hi, You can create your own timer class (that runs in a seperate thread) that keeps track of the time. This class sends an indication to the main class when the timer expires. for e.g. Timer class implements Runnable 1) Get the Max time. 2) In the run(), start a counter that counts the time elapsed. 3) Make the Thread sleep ...

6. Time Control    coderanch.com

8. Bhaaio! Time Component Needed    coderanch.com

This is almost it but I don't know why it is not displaying the String. I have other things to do right now but I will surely work on that soon ! package test.lang; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.Timer; import javax.swing.JFrame; import java.awt.Container; import java.awt.Graphics; import java.awt.Font; import java.awt.BorderLayout; import java.util.Date; public class TimeComponent { public static final int DEFAULT_UPDATE_PERIOD ...





10. ScreenSize for the umpteenth-time    coderanch.com

With Toolkit.getDefaultToolkit().getScreenSize() I get the actual ScreenSize. But I want the ScreenSize WITHOUT the standard MS-TASKBAR (in consideration of taskbar heigth and position on the screen[can be at N/S/W/E of screen]). Has someone a solution for this without using JNI or has someone a c++ class for that and an instruction how to use it because I havent worked with JNI ...

11. Real-time GUI and polling    coderanch.com

Hi, My guess is that unless your threads are synchronizing with each other, the reading thread might be trying to read something that isn't actually there. Without seeing your code, I suspect this is why the index position is out of bounds on the reading thread. Cheers, Jared. [ January 25, 2005: Message edited by: Jared Cope ]

12. Time out a Swing application by inactivity    coderanch.com

It should be possible to timeout a Swing application by user inactivity, but I have not been able to figure it out or find it in the Internet. I can set a timer as a mouse and key listener in the main frame, but event in internal frames or dialogs do not trigger the timer actions. Could someone please tell me ...

13. Time Zone Issue    coderanch.com

14. Taking more time when time loaded.    coderanch.com

Hi all, I have developed swing based java application. I have overwritten most of the paintComponent methods for customizing look and feel. I have 3 xml files, First file consists of background colors(like 123,123,123), foreground colors of various components and other files consists of some data.So, when i load the application first those 3 files must be parsed and loads the ...

15. Two JSCROLL bars to slide at same time    coderanch.com

16. hard time with swing    coderanch.com

public class InsidePane extends JPanel{ private int posX=20; private int posY=20; private String str="Test"; public int getPosX() { return posX; } public void setPosX(int posX) { this.posX = posX; } public int getPosY() { return posY; } public void setPosY(int poxY) { this.posY = poxY; } public void paintComponent(Graphics g){ g.drawString(this.str,this.posX, this.posY); } }





17. can't rotate ellipse after certain period of time    coderanch.com

i have written code which will rotate ellipse after a certain period of time : here's the code import javax.swing.*; import java.awt.event.*; import java.awt.*; import java.awt.geom.*; public class RenderShape1 { public static void main(String... args) { EventQueue.invokeLater(new Runnable() { public void run() { Wind w1=new Wind(); w1.setVisible(true); w1.setDefaultCloseOperation(w1.EXIT_ON_CLOSE); } }); } } class Wind extends JFrame { JLabel l1; JButton b1; ...

18. Having a hard time figuring out how to accomplish this in Swing    coderanch.com

I am not super-familiar with swing but I am slowly learning. Basically, I have a viewer that extends JPanel. That viewer has two areas: the top is a pane that has a bunch of buttons in it, and the rest of it is a JLayeredPane (it is not necessary that it be a JLayeredPane; I am just using that right now ...

19. Editable screensaver that is running all the time    coderanch.com

import java.awt.*; import java.awt.Color.*; import java.awt.event.*; import java.awt.geom.*; import javax.swing.*; public class Paint extends JPanel implements MouseMotionListener, MouseListener { boolean dragging, delete; private int mX, mY; static Toolkit tk = Toolkit.getDefaultToolkit(); static Dimension d = tk.getScreenSize(); static JFrame window = new JFrame(); public Paint() { setFocusable(false); addMouseMotionListener(this); addMouseListener(this); setLayout(null); JButton reset = new JButton("Reset"); reset.setBounds(0, 0, 75, 20); add(reset); reset.addActionListener(new ActionListener() ...

21. Perhaps this time the fleet needs to sail    coderanch.com

Last night I solved my problem with a JLayeredPane merely by preparing the SSCCE (or whatever the acronym is). But this time I seem to be well and truly stuck. Here's the basic code, which does in fact compile and produce results that are not what I think they should be: mainFrame=new JFrame(); mainFrame.setSize(frameWidth, frameHeight); mainFrame.setVisible(true); mainFrame.setTitle("Test Title"); JLayeredPane layeredPane=mainFrame.getLayeredPane(); JLabel ...

22. calculate time difference b/w two time entry    coderanch.com

hello Sir Please help me I m developing screen for login where I mentioned to give login time in AM and PM.I m using spinner to enter time and calculating the time but there is some problem. I m using simpleDateFormat class constructor("HH:mm:ss") but not getting d difference. Please help me to get time difference b/w two time inputs like 10.05AM ...

24. Java Swing Time    coderanch.com

Well, what you can do is get System.currentTimeMillis() and System.nanoTime() at the start of your application. Let's call the first one "time" and the second one "start". If at any point during the execution of your application you want to know the current time, call System.nanoTime() and subtract "start" from it. The result is the amount of nano-seconds since "time". Neither ...

25. How to update in real time    java-forums.org

Hello, I have an application that fills a jlist from a mysql database. I've implemented an updateList() function that I use for updating the list after a create or delete operation. So here is my question: How do I update the list in real time...meaning...if the database is modified outside the application(say the MySql Command Line Program) I want my list ...

26. First time using Java need help with GUI    forums.oracle.com

First question is, do you want to make a Dialog or a Frame? That is, do you want this class to be GUI application itself? Seeing that you have an empty main(String[]) method and you're calling the JDialog constructor with the parent Frame set to null, I'm suspecting that you may want to actually extend the JFrame class. Here's an exerpt ...

27. real time applications of swing    forums.oracle.com

28. What can one do to decrease start-up time on GUI?    forums.oracle.com

You might have had more luck in the Swing section. Its hard to tell you what to change without knowing how you are writing the code in the first place. Are you doing processing / loading in the awt/swing event thread (whatever its called, lol)? If so that will slow things down. Look up SwingUtilities.invokeLater()

29. Creating new GUI components in real time    forums.oracle.com

I am working on an app that returns anywhere from 10-100 (maybe more) search results (just text) to the user. Currently I have the results popping up in a JTextArea one at a time, as it is easy to update the TextArea in real time and make it scrollable. But now I want there to be a clickable button with each ...

30. java Swing Application start only one time, how to restrict ?    forums.oracle.com

hi I have to trouble to start application only once, how to restrict , I have to open different command prompt and run my application the first command prompt run successfully , and I want the second command prompt run the same application , this will not run. this will be give an error message , how to design this arch. ...

31. java Swing Application start only one time, how to restrict ?    forums.oracle.com

hi I have to trouble to start application only once, how to restrict , I have to open different command prompt and run my application the first command prompt run successfully , and I want the second command prompt run the same application , this will not run. this will be give an error message , how to design this arch. ...

32. how to include Time delay in GUI enviroment    forums.oracle.com

hi all, i want to include time delay while drawing the shapes in the Canvas. I tried with Thread.sleep() and also delaying methods by making them to loop for large number of times.... but it affects the repainting of my Frame window like just previously executed snippet of the code gets repeated again and the delay between the shapes drawn cannot ...