Prob with Swing Refreshing --Help Me

Hii
I have created a GUI in Swings, i need to apply some changes with one button click, but
the changes dont get implemnet till i minimise and again maximize the frame,
I am using repaint() method to get it refresh ,but it wont work
Pls Help me if u can
Thanx
Your Friend

if ur changing components and similar this usually does the work:
parentcomponent.validate(); //or revalidate()
parentcomponent.repaint();
where parentcomponent would be the container of the changed components.

Similar Messages

  • Reversing with swing? Help!

    Alright, before you guys flip out and say post it to the swing forum, why does the swing forum say read only? Now I have searched the forum but cannot find anything that deals with swing and the kind I am doing. So if you can provide some advice or some help, it would be greatly appreciated. This is my last hurdle to tackle in my school project.
    I tried a StringBuffer approach but it kept giving me an error saying it would not work with JTextArea? Maybe the code was wrong?
    This needs to take the text on the screen which I have and post it reversed when the "Reverse" button is clicked... I have been searching the web and these forums and all the different reverse methods and theories are confusing me, I try to copy them and get them to work but I just keep receiving errors. What is the best way to do this with using GUI?
    else if (actionCommand.equals("Reverse"))
              reverseMemo = theText.getText();
    /*Is this where I would put the reverse code?*/          
    theText.setText(reverseMemo);
         }Thanks,
    Jess

    Just write a method to reverse the text
    read the string in reverse and start plugging the values into a string buffer (inside a loop of course)
    then display results:
    textfield.setText(stringbuffer.toString());
    This is my last hurdle to tackle in my school project.I highly doubt it.
    The fact you are asking this question shows me you did not learn anything about Java much less computer science. Your question has nothing to do with swing.

  • Newby has problems with swing - please help

    hi guys I'm sure this is easy for someone. My Program myTimeCalc.java fails to run with a nullpointerexception. I realise I am very new to this so if I'm doing something really stupid then hey its about time I learnt. So thanks in advance and any help greatly appreciated.
    import java.awt.*;
    import javax.swing.*;
    public class myTimeCalc extends JFrame {
        public myTimeCalc() {
            super("Time Calc");
            setSize(400,400);
            setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            timeField time1 =new timeField();
            timeField time2 =new timeField();
            JPanel panel = new JPanel();
            panel.add(time1);
            panel.add(time2);
            add(panel);
            setVisible(true);
        } // myTimeCalc
        public class timeField extends JPanel {
            public int hours;
            public int mins;
            public hoursField txtHours;
            public minsField txtMins;
            public JLabel lab;
            public timeField() {
                hoursField txtHours = new hoursField();
                minsField txtMins= new minsField();
                JLabel lab = new JLabel(":");
                //txtHours.setText("0");
                //txtMins.setText("0");
                setTime(0,0);
                add(txtHours);
                add(lab);
                add(txtMins);
            } // timeField
            public void setTime(int inHours, int inMins) {
                hours = inHours;
                mins = inMins;
                txtHours.setText("" + inHours );
                txtMins.setText("" + inMins);
            public class hoursField extends JTextField {
                public hoursField() {
                    super(4);
            } // hoursField
            public class minsField extends JTextField {
                public minsField() {
                    super(2);
            } // minsField
        } // timeField
        public static void main(String[] args) {
            myTimeCalc mtc = new myTimeCalc();
    } // myTimeCalc

    Hi Phill.,
    I have altered your code. Just a little bit. take a look.
    Please do changes accordingly. And better use NetBeans IDE for developing a swing application.
    -sps. :)
    import java.awt.*;
    import javax.swing.*;
    public class myTimeCalc extends JFrame
         private JPanel panel;
        public myTimeCalc()
            //super("Time Calc");
            initComponents();
        } // myTimeCalc
        private void initComponents()
            setSize(400,400);
            setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            timeField time1 =new timeField();
            timeField time2 =new timeField();
            panel = new JPanel();
            panel.add(time1);
            panel.add(time2);
            getContentPane().add(panel);
            pack();
            setVisible(true);
        public class timeField extends JPanel
            public int hours;
            public int mins;
            public hoursField txtHours;
            public minsField txtMins;
            public JLabel lab;
            public timeField()
                txtHours = new hoursField();   // your code is hoursField txtHours = new hoursField();  there is no need for hoursField in front of the variable txtHours coz you have already declared this variable is of type hoursField.
                txtMins= new minsField();
                lab = new JLabel(":");
                //txtHours.setText("0");
                //txtMins.setText("0");
                setTime(0,0);
                add(txtHours);
                add(lab);
                add(txtMins);
            } // timeField
            public void setTime(int inHours, int inMins)
                hours = inHours;
                mins = inMins;
                txtHours.setText("" + inHours );
                txtMins.setText("" + inMins);
            public class hoursField extends JTextField
                public hoursField()
                    super(4);
            } // hoursField
            public class minsField extends JTextField
                public minsField()
                    super(2);
            } // minsField
        } // timeField
        public static void main(String[] args)
            new myTimeCalc().show();
    } // myTimeCalc

  • Listing FTP directory with swing please help me

    hi , please i wanna now how to use JTree with FinJ
    (ftp package that provides api )
    if someone has build an ftp application using FinJ please send it to me in [email protected] or a link
    to dowload it pleaaaaaaaaaaasee
    any help will be good ( sorry for my english )

    if someone has build an ftp application using FinJ
    please send it to me in [email protected] or a link
    Don't ask people to reply by private email. Most Forum regulars believe solving problems should be a public, transparent process during which a first try at an answer can and should be corrected if someone more knowledgeable notices that it is incomplete or incorrect. Also, they get some of their reward for being respondents from being seen to be competent and knowledgeable by their peers (not to mention the possibility of collecting some of those precious Duke Dollars).
    In addition, begging (e.g. "pleaaaaaaaaaaasee") is extremely unbecoming. It's especially annoying when it's coupled with vagueness about the actual problem. Go read the finj - mini-howto. If you have trouble writing the code, come back with specific questions.

  • Problems with swing, please help!!!

    im trying to display an image made up of a set of squares.
    i have a JFrame class which has the main method placing a JComponent into its Container using the getContentPane().add method.
    the JComponent class sets up the image using the paintComponent() method
    When i try to run the program all i get is a grey frame.
    Ive looked at other threads in this forum to fix my problem but it doesnt seem to fix it.
    any help is much appreciated.

    import java.awt.*;
    import java.awt.event.*;
    import java.util.EventListener;
    import javax.swing.*;
    import java.applet.*;
    public class Display extends JFrame
         protected DisCanvas canvas;
         protected EventListener listener;
         protected boolean isApplet = false;
         public Display(boolean isApplet)
              this.isApplet = isApplet;
              //setLayout(new BorderLayout());
         //     add(makeCanvas(), BorderLayout.CENTER);
         public Display()
              //this(true);
    canvas = new DisCanvas();
    this.getContentPane().setLayout(new BorderLayout());
    this.getContentPane().add(canvas, BorderLayout.CENTER);
    this.addWindowListener(new AppCloser());
    this.setSize(300, 300);
    this.setVisible(true);
    this.repaint();
    public static void main(String[] args)
    new Display();
    static class AppCloser extends WindowAdapter
              public void windowClosing(WindowEvent e)
                   System.exit(0);
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.awt.image.*;
    public class DisCanvas extends java.awt.Canvas
    Patch[] patchArray = new Patch[100];
    int width = 200;
    int height = 300;
    BufferedImage image;
    Graphics2D g2D;
    public DisCanvas()
    patchArray[0] = new Patch(0, 0, 20, 30); patchArray[10] = new Patch(0, 30, 20, 30);
    patchArray[1] = new Patch(20, 0, 20, 30); patchArray[11] = new Patch(20, 30, 20, 30);
    patchArray[2] = new Patch(40, 0, 20, 30); patchArray[12] = new Patch(40, 30, 20, 30);
    patchArray[3] = new Patch(60, 0, 20, 30); patchArray[13] = new Patch(60, 30, 20, 30);
    patchArray[4] = new Patch(80, 0, 20, 30); patchArray[14] = new Patch(80, 30, 20, 30);
    patchArray[5] = new Patch(100, 0, 20, 30); patchArray[15] = new Patch(100, 30, 20, 30);
    patchArray[6] = new Patch(120, 0, 20, 30); patchArray[16] = new Patch(120, 30, 20, 30);
    patchArray[7] = new Patch(140, 0, 20, 30); patchArray[17] = new Patch(140, 30, 20, 30);
    patchArray[8] = new Patch(160, 0, 20, 30); patchArray[18] = new Patch(160, 30, 20, 30);
    patchArray[9] = new Patch(180, 0, 20, 30); patchArray[19] = new Patch(180, 30, 20, 30);
    patchArray[20] = new Patch(0, 60, 20, 30); patchArray[30] = new Patch(0, 90, 20, 30);
    patchArray[21] = new Patch(20, 60, 20, 30); patchArray[31] = new Patch(20, 90, 20, 30);
    patchArray[22] = new Patch(40, 60, 20, 30); patchArray[32] = new Patch(40, 90, 20, 30);
    patchArray[23] = new Patch(60, 60, 20, 30); patchArray[33] = new Patch(60, 90, 20, 30);
    patchArray[24] = new Patch(80, 60, 20, 30); patchArray[34] = new Patch(80, 90, 20, 30);
    patchArray[25] = new Patch(100, 60, 20, 30); patchArray[35] = new Patch(100, 90, 20, 30);
    patchArray[26] = new Patch(120, 60, 20, 30); patchArray[36] = new Patch(120, 90, 20, 30);
    patchArray[27] = new Patch(140, 60, 20, 30); patchArray[37] = new Patch(140, 90, 20, 30);
    patchArray[28] = new Patch(160, 60, 20, 30); patchArray[38] = new Patch(160, 90, 20, 30);
    patchArray[29] = new Patch(180, 60, 20, 30); patchArray[39] = new Patch(180, 90, 20, 30);
    patchArray[40] = new Patch(0, 120, 20, 30); patchArray[50] = new Patch(0, 150, 20, 30);
    patchArray[41] = new Patch(20, 120, 20, 30); patchArray[51] = new Patch(20, 150, 20, 30);
    patchArray[42] = new Patch(40, 120, 20, 30); patchArray[52] = new Patch(40, 150, 20, 30);
    patchArray[43] = new Patch(60, 120, 20, 30); patchArray[53] = new Patch(60, 150, 20, 30);
    patchArray[44] = new Patch(80, 120, 20, 30); patchArray[54] = new Patch(80, 150, 20, 30);
    patchArray[45] = new Patch(100, 120, 20, 30); patchArray[55] = new Patch(100, 150, 20, 30);
    patchArray[46] = new Patch(120, 120, 20, 30); patchArray[56] = new Patch(120, 150, 20, 30);
    patchArray[47] = new Patch(140, 120, 20, 30); patchArray[57] = new Patch(140, 150, 20, 30);
    patchArray[48] = new Patch(160, 120, 20, 30); patchArray[58] = new Patch(160, 150, 20, 30);
    patchArray[49] = new Patch(180, 120, 20, 30); patchArray[59] = new Patch(180, 150, 20, 30);
    patchArray[60] = new Patch(0, 180, 20, 30); patchArray[70] = new Patch(0, 210, 20, 30);
    patchArray[61] = new Patch(20, 180, 20, 30); patchArray[71] = new Patch(20, 210, 20, 30);
    patchArray[62] = new Patch(40, 180, 20, 30); patchArray[72] = new Patch(40, 210, 20, 30);
    patchArray[63] = new Patch(60, 180, 20, 30); patchArray[73] = new Patch(60, 210, 20, 30);
    patchArray[64] = new Patch(80, 180, 20, 30); patchArray[74] = new Patch(80, 210, 20, 30);
    patchArray[65] = new Patch(100, 180, 20, 30); patchArray[75] = new Patch(100, 210, 20, 30);
    patchArray[66] = new Patch(120, 180, 20, 30); patchArray[76] = new Patch(120, 210, 20, 30);
    patchArray[67] = new Patch(140, 180, 20, 30); patchArray[77] = new Patch(140, 210, 20, 30);
    patchArray[68] = new Patch(160, 180, 20, 30); patchArray[78] = new Patch(160, 210, 20, 30);
    patchArray[69] = new Patch(180, 180, 20, 30); patchArray[79] = new Patch(180, 210, 20, 30);
    patchArray[80] = new Patch(0, 240, 20, 30); patchArray[90] = new Patch(0, 270, 20, 30);
    patchArray[81] = new Patch(20, 240, 20, 30); patchArray[91] = new Patch(20, 270, 20, 30);
    patchArray[82] = new Patch(40, 240, 20, 30); patchArray[92] = new Patch(40, 270, 20, 30);
    patchArray[83] = new Patch(60, 240, 20, 30); patchArray[93] = new Patch(60, 270, 20, 30);
    patchArray[84] = new Patch(80, 240, 20, 30); patchArray[94] = new Patch(80, 270, 20, 30);
    patchArray[85] = new Patch(100, 240, 20, 30); patchArray[95] = new Patch(100, 270, 20, 30);
    patchArray[86] = new Patch(120, 240, 20, 30); patchArray[96] = new Patch(120, 270, 20, 30);
    patchArray[87] = new Patch(140, 240, 20, 30); patchArray[97] = new Patch(140, 270, 20, 30);
    patchArray[88] = new Patch(160, 240, 20, 30); patchArray[98] = new Patch(160, 270, 20, 30);
    patchArray[89] = new Patch(180, 240, 20, 30); patchArray[99] = new Patch(180, 270, 20, 30);
    image = new BufferedImage(width, height,BufferedImage.TYPE_INT_ARGB);
    Graphics2D g2D = image.createGraphics();
    public void paint/*Component*/(Graphics g)
    g = (Graphics2D) g2D;
    super.paint/*Component*/(g);
    for (int i = 0; i == 99; i++)
    //for (int s = 0; s > 5; s++)
    // Color[] colours = new Color[6];
    // colours[0] = Color.blue;
    // colours[1] = Color.red;
    // colours[2] = Color.green;
    // colours[3] = Color.orange;
    // colours[4] = Color.black;
    // colours[5] = Color.white;
    // g2D.setColor(colours[s]);
    g2D.setColor(Color.red);
    g2D.fillRect(patchArray.getX(), patchArray[i].getY(),
    patchArray[i].getWidth(), patchArray[i].getHeight());
    g2D.drawImage(image,0, 0, this);

  • I'm a photoshop user on Mac and I was obliged to uninstall Photoshop because prob with generator. Now it's impossible for me to re-download Photoshop. Can you Help? Please

    I'm a photoshop user on Mac and I was obliged to uninstall Photoshop because prob with generator. Now it's impossible for me to re-download Photoshop. Can you Help? Please

    Run the cleaner tool and try again.
    Use the CC Cleaner Tool to solve installation problems | CC, CS3-CS6
    Mylenium

  • Two probs with my imac need help with

    Hi all I bought my first mac for the wife but we have two probs with it we cant get on top of
    One is every time we try to access her mac that is on the same network it asking for a password
    But none of the pcs have a password on
    And the second prob is the mac losers sound on email but we are not on an imap account
    So I have read that it is something to do with the idle setting but we can not find the settings
    Can anybody help and I must say the mac is the best PC I have every used that's if I can get the wife off it

    al22,
    You have 90 days of free AppleCare telephone support. If your machine is within the 90 days or you have already bought AppleCare (STRONGLY recommended) give them a call. The support is excellent, nothing like what you are used to with a PC.
    Because you did not complete your profile we have no idea where you are located, what machine you have or the version of OS X installed. Please complete your profile, you can find it under Your Stuff in the upper right.
    http://support.apple.com/kb/HE57

  • Results for my browser has prob with 1st inch and harf from new babbilon crap will not hipolink i can not sign in or register on any thing please help

    results for my browser has prob with 1st inch and harf from new babbilon crap will not hipolink i can not sign in or register on any thing please help

    has anyone solve this problem? i upgraded my iphone 4 to 5.1.1 and now i can see only ""We're sorry, we are unable to continue with your activation at this time.  Please try again later, or contact customer care."
    i tried mani sim card, laptops, wifi. but for 7 days the problem is still exist....
    Please help me!!!

  • How to limit data range in a Line chart with Time Refresh Control

    Hi All,
    I have a Line chart with Time Refresh Control and I would like to make some constraints to this navigation.
    For example, I would like to limit the user to navigate in a data range of 8 hours.
    Is this posible?
    Thanks in advance

    Hi Pedro,
    as far as I know, this is not possible using the time controls on an iChart. However, you may have some success by using your own time controls which call JavaScript methods exposed by the applet.
    For example, you could begin by hiding the time and calendar buttons on an iChart, and creating some buttons of your own. For instance, to set the start date of a query (and thus the start date of the iChart using the query), you can use the following:
    document.getElementById("appletID").getQueryObject().setStartDate(<date string>);
    Using code like the above (look into the xMII script assistant and documentation), you should be able to build time controls which satisfy your requirements. The exact format of <date string> in the sample above will depend on the date format defined in the query template this script calls.
    Hope this helps,
    Sascha

  • Using Report tool with Swing Application

    I'd like to use a reporting tool (Crystal Reports or anything else) with Swing application. Could anyone help me?

    You have to pass the values are parameters to the Oracle Reports report. Take a look at this: http://www.oracle.com/technology/products/database/application_express/howtos/howto_integrate_oracle_reports.html
    Also you can search this forum for "Oracle Reports"
    Mike

  • E6-00: what's wrong with Belle refresh (and other ...

    I've been following this forum and have always been up-to-date with E6-00 firmware. I've been almost happy with Belle and was expecting hardly the Belle refresh version for the Music player upgrade. What I got was - ? I don't know. Just the new version and no instant visible change. However... :
    - the Music Player is the same. Meaning, no song search and still ridiculous user interface
    - the phone tries to establish the data connection quite often even if no application is open
    - the phone is hardly responsive from time to time (while looking for the network connection)
    - the phone does not want to connect to the wifi. Restart helps.
    - the phone loses the network operator and does not reconnect. Happened once (when roaming). Restart helps immediately.
    - the Microsoft Apps: pursued upgrade. I personally do not need them. The screen is simply to small to use them effectively.
    - (not a complaint) the battery life: I think the battery life is not really affected by the OS. Those complaining about shorter battery life should check how much time they spend using the phone, being connected to wifi, etc.
    I'm very disappointed with the E6-00. I try to keep it positive but it keeps me down with every (new) issue. Does anyone has advice what to do with upper mentioned issues? I bought the phone ~2 months after it was available. I'm assuming that these first production series can have hardware issues? My phone was on reparation twice: for the notification light (hardware thing) and bluetooth issues (voice not heard over the bluetooth headset). The latter is still present I think...
    I consider buying E71 since there's no other good (Nokia) phone on the market. What makes me sad the most is that my iPod touch does wifi connection and other things smoothlessly... But I don't want an iPhone (which is in principle the same as iPod touch), I just want a good Nokia.
    Regards,
    P

    strelamcqueen:
    I agree with your post except for the fact that Belle hosed my E6.  Meaning: if you look at all my other posts, it's all about the GPS data functions that were awesome with the E71 then went away with the E6 on Anna.  At least with Anna, there was an app called LeGPSData2 that restored most of the E71 GPS functionality.  LeGPSData2 is not compatible with Belle. Sooo, I am currently using my E6 ONLY because of the decent camera. 
    Belle made the UI look pretty but that's it.  I found the same problems with the responsiveness that you mentioned and issues with not connecting to my home wifi when I try to browse the net at home.  There's nothing like downloading a bunch of big files only to discover that I've chewed up a bunch of data because the phone didn't connect to wifi.  I put the wifi widget on one of my home screens and I make sure that I manually connect to wifi now before starting the browser. The Microsoft app via the upgrade were a joke. They actually took over Quick Office so that Excel and Word opened with MS Office Mobile.  This would be fine but they open so tiny they are unreadable and they are not editable with MS Office Mobile for some reason.  I removed the MS apps immediately.
    My battery life suffered a lot after Belle refresh.  With normal use as before the upgrade I would get home with about 50% battery with 3G ON.  With Belle refresh,  The battery won't make it through a full day with 3G on and I end up with about 25% battery at the end of the day with 3G off.  Good thing I don't use much data through the day!
    This is actually my second E6; long story but the first I upgraded to Belle and was disappointed with the loss of LeGPSData2 app.  This one I was forced to upgrade to Belle refresh because while updating Ovi Maps one night, the update completely deleted the Ovi Maps app and I could not get it back without updating the OS to Belle refresh. 
    So I am with you.  I too am very disappointed with the E6 but most of my disappointment comes from the software 'upgrades'.  If Nokia would just leave well enough alone, all would be fine.  I am sorry I have no advice to take care of the problems you and I are facing.  I am in search of a new phone now and if I don't downgrade to an E72, I won't be getting a Nokia again.  It's a sad story because I have been a die hard Nokia fan for a long time.
    DS
    @adrianhughes:
    HUH?  stelamcqueen is asking advice from other USERS.  That's what the forum is about.  

  • Replication with fast refresh

    hi everybody,
    I have a problem in replication with fast refresh. I used 2 Windows 2000 server with Oracle 9i Release 9.0.1.1.1 and I can't made the automatic update. This doesn't work and I cant use ON DEMAND.
    I made
    Remote server
    Create table teste (a number primary key, b varchar2(20));
    insert into teste (a, b) values (1, 'weqwuqeui');
    create materialized view log on teste with primary key;
    Server Local --------
    create materialized view admin.teste_mv
    build immediate
    refresh fast start with sysdate next sysdate + 1/1440
    with primary key as
    select * from teste@servidor1;
    Server Remote -------
    insert into teste (a, b) values (2, 'qwerty');
    The first line is in the materialized view teste_mv but the second never appear.
    I know it's a dumb trick but I can't solve this problem at the moment.
    If somebody can help I would appreciate.
    Thanks in advance

    thanks for the reply.
    The job_queue_processes parameter in both servers is set to zero
    The dba_jobs returned the following columns, every other columns are null. The next date and time is in the past.
    JOB LOG_USER 1
    PRIV_USER ADMIN
    SCHEMA_USER ADMIN
    NEXT_DATE 11-JUL-07
    NEXT_SEC 17:45:47
    TOTAL_TIME 0
    BROKEN N
    INTERVAL sysdate + 1/1440 FAILURES
    WHAT dbms_refresh.refresh('"ADMIN"."TESTE_MV"');
    NLS_ENV NLS_LANGUAGE='AMERICAN' NLS_TERRITORY='AMERICA' NLS_CURRENCY='$' NLS_ISO_CURRENCY='AMERICA' NLS_NUMERIC_CHARACTERS='.,' NLS_DATE_FORMAT='DD-MON-RR' NLS_DATE_LANGUAGE='AMERICAN' NLS_SORT='BINARY'
    MISC_ENV 0102000200000000
    INSTANCE 0
    Cheers

  • Materiazed view with fast refresh

    Hi All,
    I want to create a Materialized view with fast refresh.
    I think for fast refresh we need to set up a materialized view log first before the MV gets created.
    Can someone please provide the steps and the syntax to do this?
    I am new to MV creation so appreciate any help in this regard.
    Thanks.
    AS

    http://www.morganslibrary.org/library.html
    Look up Materialized View Log and Materialized View ... both on the same page ... build the demo MV and you can modify the code to build any others you wish.

  • ACE HTTP Probe with regex

    ACE HTTP Probe with regex
    Hi,
    I'm trying to setup a HTTP probe with expected string rather then a code (config below). I do a GET for the page then a search for a string in the response however it's not working, as probe appears as failed.
    I've tested the connection to the server by using telneting and then looking at the page displayed to make sure the string I want to match is in the response.
    probe http HTTP-PROBE
    port 43050
    interval 30
    passdetect interval 30
    passdetect count 1
    request method get url /action=help
    open 43050
    expect regex action=help
    Q. Is there anything wrong with this configuration and what I'm trying to achive?
    Thanks,
    Pritesh

    Use "expect status" under probe config. expect regex doesnt work if expect status is not configured.
    expect regex work flawlessly with static pages. It doesnt work all the time with dynamic pages.
    Specially if "content-length" header is missing from Server response.
    Hope it helps
    Syed Iftekhar Ahmed

  • Swing ActionListener help?

    Hi there,
    I'm trying to get to grips with Swing and I'm reasonably comfortable with laying out the GUI now. However, I'm still trying to get to grips with ActionListeners. As I understand it, you can have any old class as an ActionListener as long as it implements the ActionListener interface.....then you can just add this ActionListener to a component using .addActionListener().
    Couple of questions though....
    1. Is it generally bad design to just have a component call <whatever>.addActionListener(this) and then just implement the actionPerformed() method within the same class?
    2. Do you have to define a seperate ActionListener class for each type of component, or can you use one ActionListener for, say, one whole GUI screen? How do you usually organise these things?
    3. Anyone point me towards some decent tutorials on Java Swing event-handling?....preferably not the Sun ones, although if they are regarded as the best, I'll take 'em. :)
    Thanks for your time.

    URgent help need.
    i need to link the page together : by clicking the button on the index page.
    it will show the revelant class file. I have try my ationPerformed method to the actionlistener, it cannot work.
    Thanks in advance.
    // class mtab
    // the tab menu where it display the gui
    import javax.swing.*;
    import java.awt.*;
    public class mtab {
    private static final int frame_height = 480;
    private static final int frame_width = 680;
    public static void main (String [] args){
    JFrame frame = new JFrame ("Mrt Timing System");
    frame.setDefaultCloseOperationJFrame.EXIT_ON_CLOSE);
    frame.setSize(frame_width,frame_height);
    JTabbedPane tp = new JTabbedPane ();
    tp.addTab("Mrt Timing System", new sample());
    frame.setResizable(false);
    frame.getContentPane().add(tp);
    frame.setSize(680,480);
    frame.show();
    // index page
    // class sample
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.Image;
    import javax.swing.*;
    import javax.swing.event.*;
    import javax.swing.text.*;
    import java.text.*;
    import javax.swing.border.*;
    class sample extends JPanel implements ActionListener
    //button
    private JButton TimingButton;
    private JButton ViewButton;
    private JButton FrequencyButton;
    private JButton calculateButton;
    private CardLayout mycard;
    private JPanel SelectXPanel;
    private JPanel SelectYPanel;
    private JPanel SelectZPanel;
    private JPanel bigFrame, mainPane;
    // constructor
    public sample() {
    super(new BorderLayout());
    //create the object
    //create button and set it
    TimingButton = new JButton("MRT Timing Calculator");
    TimingButton.addActionListener(this);
    ViewButton = new JButton("View First and Last Train");
    ViewButton.addActionListener(this);
    FrequencyButton = new JButton("Show the Train Frequency");
    FrequencyButton.addActionListener(this);
    // Layout
    //Lay out the button in a panel.
    JPanel buttonPane = new JPanel(new GridLayout(3,0));
    buttonPane.add(TimingButton);
    buttonPane.add(ViewButton);
    buttonPane.add(FrequencyButton);
    // Layout the button panel into another panel.
    JPanel buttonPane2 = new JPanel(new GridLayout(0,1));
    buttonPane2.add(buttonPane);
    tfrequency x = new tfrequency();
    fviewl2 y = new fviewl2 ();
    timing z = new timing ();
    JPanel SelectXPanel = new JPanel(new GridLayout(0,1));
    SelectXPanel.add(x);
    JPanel SelectYPanel = new JPanel(new GridLayout(0,1));
    SelectYPanel.add(y);
    JPanel SelectZPanel = new JPanel(new GridLayout(0,1));
    SelectZPanel.add(z);
    // Layout the button by putting in between the rigid area
    JPanel mainPane = new JPanel(new GridLayout(3,0));
    mainPane.add(Box.createRigidArea(new Dimension(0,1)));
    mainPane.add(buttonPane2);
    mainPane.add(Box.createRigidArea(new Dimension(0,1)));
    mainPane.setBorder(new TitledBorder("MRT Timing System"));
    // x = new tfrequency();
    // The overall panel -- divide the frame into two parts: west and east.
    JPanel bigFrame = new JPanel(new GridLayout(0,2));
    bigFrame.add(mainPane, BorderLayout.WEST);
    //bigFrame.add(x,BorderLayout.EAST); // this is where i want to link the page
    // this page being the index page. there being nothing to display.
    add(bigFrame);
    //Create the GUI and show it. For thread safety,
    public void actionPerformed (ActionEvent e){
    if (e.getSource() == TimingButton ){
    JPanel bigFrame = new JPanel(new GridLayout(0,2));
    bigFrame.add(mainPane, BorderLayout.WEST);
    bigFrame.add(SelectZPanel,BorderLayout.EAST);
    add(bigFrame);
    else if (e.getSource() == ViewButton ){
    JPanel bigFrame = new JPanel(new GridLayout(0,2));
    bigFrame.add(mainPane, BorderLayout.WEST);
    bigFrame.add(SelectYPanel,BorderLayout.EAST);
    add(bigFrame);
    else if (e.getSource() == FrequencyButton ){
    JPanel bigFrame2 = new JPanel(new GridLayout(0,2));
    bigFrame.add(mainPane, BorderLayout.WEST);
    bigFrame.add(SelectXPanel,BorderLayout.EAST);
    add(bigFrame);
    // Train Frequency Page
    // class fviewl2
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.Image;
    import javax.swing.*;
    import javax.swing.event.*;
    import javax.swing.text.*;
    import java.text.*;
    import javax.swing.border.*;
    class fviewl2 extends JPanel implements ActionListener
    //Labels to identify the fields
    private JLabel stationLabel;
    private JLabel firstLabel;
    private JLabel lastLabel;
    //Strings for the labels
    private static String station = "MRT Station:";
    private static String first = "First Train Time:";
    private static String last = "Last Train Time:";
    //Fields for data entry
    private JFormattedTextField stationField;
    private JFormattedTextField firstField;
    private JFormattedTextField lastField;
    //button
    private JButton homeButton;
    private JButton cancelButton;
    private JButton calculateButton;
    public fviewl2()
    super(new BorderLayout());
    //create the object
    //Create the Labels
    stationLabel = new JLabel(station);
    firstLabel = new JLabel (first);
    lastLabel = new JLabel (last) ;
    //Create the text fields .// MRT Station:
    stationField = new JFormattedTextField();
    stationField.setColumns(10);
    stationField.setBounds(300,300,5,5);
    //Create the text fields // First Train Time:
    firstField = new JFormattedTextField();
    firstField.setColumns(10);
    firstField.setBounds(300,300,5,5);
    //Create the text fields //Last Train Time:
    lastField = new JFormattedTextField();
    lastField.setColumns(10);
    lastField.setBounds(300,300,5,5);
    //Tell accessibility tools about label/textfield pairs, matching label for the field
    stationLabel.setLabelFor(stationField);
    firstLabel.setLabelFor(firstField);
    lastLabel.setLabelFor(lastField);
    //create button and set it
    homeButton = new JButton("Home");
    //homeButton.addActionListener(this);
    cancelButton = new JButton("Cancel");
    cancelButton.addActionListener(this);
    calculateButton = new JButton("Get Time");
    // Layout
    //MRT Station Label // insert into the panel
    JPanel StationPane = new JPanel(new GridLayout(0,1));
    StationPane.add(stationLabel);
    //MRT Station input field // insert into the panel
    JPanel StationInput = new JPanel(new GridLayout(0,1));
    StationInput.add(stationField);
    //Get Time Button // insert into the panel
    JPanel GetTime = new JPanel(new GridLayout(0,1));
    GetTime.add(calculateButton);
    //Lay out the labels in a panel.
    JPanel FlabelL = new JPanel(new GridLayout(0,1));
    FlabelL.add(firstLabel);
    FlabelL.add(lastLabel);
    // Layout the fields in a panel
    JPanel FFieldL = new JPanel(new GridLayout(0,1));
    FFieldL.add(firstField);
    FFieldL.add(lastField);
    //Lay out the button in a panel.
    JPanel buttonPane = new JPanel(new GridLayout(1,0));
    buttonPane.add(homeButton);
    buttonPane.add(cancelButton);
    // Layout all components in the main panel
    JPanel mainPane = new JPanel(new GridLayout(4,2));
    mainPane.add(StationPane);
    mainPane.add(StationInput);
    mainPane.add(Box.createRigidArea(new Dimension(0,1)));
    mainPane.add(GetTime);
    mainPane.add(FlabelL);
    mainPane.add(FFieldL);
    mainPane.add(Box.createRigidArea(new Dimension(0,1)));
    mainPane.add(buttonPane);
    mainPane.setBorder(new TitledBorder("View First and Last Train"));
    JPanel leftPane = new JPanel(new GridLayout(1,0));
    leftPane.add(Box.createRigidArea(new Dimension(0,1)));
    leftPane.add(mainPane);
    leftPane.add(Box.createRigidArea(new Dimension(0,1)));
    JPanel hahaFrame = new JPanel(new GridLayout(0,1));
    hahaFrame.add(Box.createRigidArea(new Dimension(0,1)));
    hahaFrame.setBorder(BorderFactory.createEmptyBorder(30, 10, 80, 150));
    hahaFrame.add(Box.createRigidArea(new Dimension(0,1)));
    JPanel bigFrame = new JPanel();
    bigFrame.add(hahaFrame, BorderLayout.NORTH);
    bigFrame.add(leftPane, BorderLayout.CENTER);
    add(bigFrame, BorderLayout.CENTER);
    //Create the GUI and show it. For thread safety,
    private void cancelButtonClicked()
    stationField.setText("");
    firstField.setText("");
    lastField.setText("");
    public void actionPerformed (ActionEvent e){
    if (e.getSource() == cancelButton){
    cancelButtonClicked();
    }

Maybe you are looking for

  • Safari doesnt open some webpages!

    Safari doesnt open lots of the webpages I go on a lot. I used to be able to go on bebo with this computer, but now it cannot find the server. I need to go on macromedia.com and it cannot find that site either! And metacafe.com... theres a whole lot o

  • How to use a custom schema in Max DB?

    Hi all I use a jdbc datasource to connect to max db. For those who know maxdb the DB structure is as follows. dbaname -> Tables -> Schema -> MyTable The data source url refers to hostname/dbname. When I make a query on the data base like select * fro

  • TOPCOUNT query not working

    When I run the query below I only get 2 records back. If I drop the TOPCOUNT, I get 508 records. Why is it not giving me the top 5 from the 508 records? What am I missing? Regs Jon with MEMBER Measures.[EmailCount] as IIF(ISEMPTY([Measures].[Tran Cou

  • Java java.lang.Exception Fatal Error on php5 webpage

    Hi, we are trying to make a php webpage run on our machine but at one point it shows the below error. Also, Im absolute newbie to java As far i have details this page is run on php5 with java 6 on Debian 4.0. Fatal error: Uncaught [[o:Exception]:"jav

  • How to transfer AP invoice to FA in case the accounting method cash basis

    hello all, please i need you help in something i'm using the cash basis as accouting method ,and i tried to transfer AP invoice with distribution line 'asset clearing' to FA but there is no line is appeared in FA modules as new mass addition taking i