Re: Timer event appears to move window



On Tue, 26 Jul 2005 19:45:50 +0100, Ed wrote:

> Hi Im new to Swing (and a lot other Java things to be honest)....

<http://www.physci.org/codes/javafaq.jsp#cljh>

> s would be grateful for any assistance.
>
> Im writing an app that is MDI based Ive got an JFrame MDI into which I have
> a menu bar and menu items etc and a status bar (a JPanel attached to SOUTH)

ughh.. let the code do the talking..
<http://www.physci.org/codes/sscce.jsp>

...but having said that, you might *try*..

> mnuNewCase.addActionListener(new java.awt.event.ActionListener() {
> public void actionPerformed(java.awt.event.ActionEvent e) {

System.out.println("ActionEvvent " + e);

> Caseframe newCase=new Caseframe();
> desktopPane.add(newCase);
> }
> });

....

> private class MyStatusTask extends TimerTask {
> private SimpleDateFormat formatter; // Formats the date displayed
> private String today;
> private String now;
> private Date currentDate; // Used to get date to display
>
> public void run() {

System.out.println("Run..");

>
> currentDate = new Date();
> formatter = new SimpleDateFormat ("EEE MMM dd hh:mm:ss yyyy",
> Locale.getDefault());
>
> formatter.applyPattern("dd/MMM/yyyy");
> today = formatter.format(currentDate);
> dateField.setText(today);
>
> formatter.applyPattern("HH:mm:ss");
> now = formatter.format(currentDate);
> timeField.setText(now);
> }
> }
...
> any thoughts as to why the JInternalFrame jumps around ? Is it the timer
> getting in the way ?

'Getting in the way'? Why? How wide did you make it? [ ;-) ]

--
Andrew Thompson
physci.org 1point1c.org javasaver.com lensescapes.com athompson.info
Mr Bender's Wardrobe By ROBOTANY 500
.



Relevant Pages