Swing Vs. Awt question

this link http://www.jguru.com/faq/view.jsp?EID=106026
mentions on feature at the end of the article that
"If you're not very careful when programming, it can be slower than AWT (all components are drawn) "
What is means. I mean what kind of carefulness he is talking about?
I have JApplet and Jframe used heavily and looks like it's kind of slow.
I am thinking to change it to awt based.
Any advise
thnks

I don't know what that means either. But I do notice that it was written nearly seven years ago. Things that were said seven years ago about Java performance are totally useless today, so don't pay any attention to that.

Similar Messages

  • Quick practical question: swing vs. awt

    Hi,
    I have an app/applet w/ a fairly simple calculator-type gui. But I want it to run well even on old Pentiums. How much will it matter if I use swing or awt, in terms of performance of the app, ie. user response to gui input? Is it really noticeable?
    Does the system resource usage differ as well even while there is no user input?
    TIA,
    Reggie

    In my experience swing often performs better than awt does, as far as memory and speed...
    Swing can't run in IE without a plugin tho, so consider that before you start switching

  • Awt question

    i want to develop app in awt.i want to know how to disable certain feature when the application is running in full screen mode. also if i want to run the application in windows and mac will it work for both. how to develop a common code and determine which os it is?

    hi db, you kept on referring it to as same topic but in my own limited knowledge, i know that both swing and awt are not same one is lightweight another is heavyweight. let me not go into it. but you may wish to refer to the following post:
    http://forum.java.sun.com/thread.jspa?threadID=271579&messageID=1044844
    hello morgalr,
    thanks for the reply. i am sorry if i have not been able to make my specific
    query clear:-
    1> I wish to develop an application in awt, in that app based on the fact that if the app is running in full screen, i want to disable certain menu option. my question is how to determine that my application is now running in full screen mode.
    2> i wish to develop a common code which runs on both mac and windows. based on the fact that which os is it running, i want to add/remove certain menu options.i want to know the value of constants/ways of doing it.
    i hope things are now clear. please help me as quickly as possible.

  • Need  java code to perform refresh button action using swings and awt

    i need java code to perform refresh button action using swings and awt.please help me

    Wait ! Noboby ? OK, I'll do it
    public void onBtnAction ()
        if (!fresh)
            refresh ();
    }Seriously, did you expect anyone to answer such a cryptic question ?

  • Is there AWT questions in SCJP 1.5 exam?

    Is there AWT questions in SCJP 1.5 exam?
    In official exam description there is no mentioned about AWT.
    In Sybex certification guide, 5th edition, AWT also plased out of SCJP section.
    but some mock exams contains quite a lot of AWT questions.
    e.g. http://www.jchq.net/mockexams/exam1.htm
    Could people who passed the SCJP test tell me the real facts about AWT ?

    Is there AWT questions in SCJP 1.5 exam?
    In official exam description there is no mentioned
    about AWT.I don't think AWT is an issue, either. I'm not even sure whether Swing is a part. AWT is outdated ever since Swing was integrated in 1.2.

  • Shall i use Swing or AWT for creating a chessboard applet??

    Hi,
    I need to build an applet which should dislpay a chessboard where i should
    be able to move the pieces around, read in a game analysis, etc...
    I am a beginner and i would like some advice on if i should use swing or awt?
    Which one is it easier to work with in terms of dispaying the pieces, moving the pieces and achieving other more challenging functionalities?
    Is it good idea to mix both of them? i.e have a japplet and use a canvas for displaying the board??
    Any advice would be much obliged.

    I used to think AWT
    And someone told me Swing was better..and that all of the Drag-n-Drop stuff doesn't work well with AWT.
    I have to admit that I used AWT up until a project about 3 months ago--I liked it better, but Swing does seem to have more builtins for handling the things you would need to for the Chess Board. Not that you CAN'T do them with AWT, but that they are harder to do with AWT.
    As far as reading in game analysis, etc..that really is independent of Swing/AWT

  • Swing vs AWT (which should I learn?)

    I am writting an mp3 player in Java. I am fairly new to Java as all I know is the programming language; I do not know how to make a GUI. I want to make a cross platform mp3 player that should run on mac, windows and Linux. I also want to use some custom buttons made in Photoshop.
    Should I invest time in learning Swing or AWT?
    Thank you for your help.

    Hello,
    this depends on how far You intend to go with "customizing". Swing leaves a few things to the Operating System e.g. Windows or Linux. My swing apps look different under Linux than they do under Windows, because the Frame in which these apps are are drawn is administered by the OP System. On the other hand if customizing means for example changing the java cup icon upper left or changing the Title of the frame, then You will have no problems. More generally spoken: nearly everything can be done as long as You stay with the possibilities You have (Buttons, TextField, Bars ... have a look at the Swing Platfrom !).

  • Is it possible to use events for objects that do not use swing or awt

    Dear Experts
    I want to know if events are possible with plain java objects. A simple class that is capable of firing an event and another simple class that can receive that event. My question is
    1. If it is possible - then what is the approach that needs to be taken and would appreciate an example.
    2. Is Observer Pattern in java going to help?
    To explain further i am doing [Add,Modify,Delete,Traverse] Data tutorial using swing in Net beans. I have a ButtonState Manager class that enables and disables buttons according to a given situation. For example if add is clicked the modify button becomes Save and another becomes Cancel. The other buttons are disabled. What i want is the ButtonStateManager class to do a little further - i.e. if Save is clicked it should report to DBClass that it has to save the current record which was just added. I am foxed how this can be done or what is the right way. Thanks for reading a long message. Appreciate your help.
    Best regards

    Thanks Kayaman
    i guess i am doing something else maybe it is crazy but i need to work further i guess... i cant post the entire code as it is too big but some snippets
    public class DatabaseApplication extends javax.swing.JFrame {
        ButtonStateManager bsm;
        /** Creates new form DatabaseApplication */
        public DatabaseApplication() {
            initComponents();
            // ButtonStateManager has a HUGE constructor that takes all the buttons as argument!
            bsm = new ButtonStateManager(
                    btnAdd,
                    btnModify,
                    btnDelete,
                    btnQuit,
                    btnMoveNext,
                    btnMovePrevious,
                    btnMoveLast,
                    btnMoveFirst );One of the methods in the ButtonStateManager Class is as follows
      private void modifyButtonState()
            btnAdd.setText("Save");
            btnModify.setEnabled(false);
            btnDelete.setText("Cancel");
            btnQuit.setEnabled(false);
            ...Finally the Crazy way i was trying to do ... using EXCEPTIONS!
      void modifyClicked() throws DBAction
            if(btnModify.getText().equalsIgnoreCase("MODIFY"))
                modifyButtonState();
            else
                throw new DBAction("SaveAddedRecord");
        }And Finally how i was Tackling exceptions....
      private void btnAddActionPerformed(java.awt.event.ActionEvent evt) {                                      
          try {
                bsm.addClicked();
            } catch (Exception e1) {
                processDBAction(e1.getMessage());
        private void processDBAction(String msg)
            if(msg.equalsIgnoreCase("SAVEMODIFIEDRECORD"))
                System.err.println(msg);
                bsm.normalButtonState();
            }Edited by: standman on Mar 30, 2011 4:51 PM

  • Running the Swing or AWT code in the UNIX

    I have developed the code to modify the XML attribute values using Java. Those attribute values are accepted from the GUI which i have designed using swings as well as AWT.
    The code is perfectly working in the DOS/Windows environment. The applet/Display is perfectly popping up and accepting the data and it is making the required changes in the XML and creating the new XML.
    But the problem i am facing is,
    I compiled the same code in UNIX and then run the code. But it threw the exception as below. Can anyone help me out for this. What i need to do in order to run that code successfully??.
    bash-3.00$ java GUIAjay
    No X11 DISPLAY variable was set, but this program performed an operation which requires it.
    at java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:159)
    at java.awt.Window.<init>(Window.java:407)
    at java.awt.Frame.<init>(Frame.java:402)
    at javax.swing.JFrame.<init>(JFrame.java:207)
    at GUIAjay.<init>(GUIAjay.java:44)
    at GUIAjay.main(GUIAjay.java:39)
    I tried to set the X11 window server as:
    export DISPLAY=10.5.21.117:0
    But yet the User Interface is not popping up in the UNIX??.
    May be the problem is because GUI is not supported in UNIX.. So please suggest me on this..

    *Don't post general Java questions here*

  • Is there an internet browser component in swing or awt?

    Im developing an internet browser using swing, is there any component or that?

    If you just need to open a url you can use
    java.awt.Desktop.getDesktop().open(...);
    should check first if desktop is present and OPEN is supported, otherwise there are some snippet you can google that search/launch a browser based on OS.
    If you need to integrate a browser in your app, as far as I know, SWT makes it easier.
    Bye.

  • Should I compare SWT to Swing or AWT?

    I am currently doing my dissertation on ways to speed up a Java GUI. Obviously I am comparing the SWT (Eclipse project) to Swing and not really focusing on the AWT (Sun dont seem to be?!). I am interested in looking at how you could create a Swing interface that could compete with the speed of the SWT? I am also looking at the feature set of each and hopefully going to conclude, which is the better widget toolkit, for a highly performant GUI with respect to speed and features?
    Any facts (& opinions :-) would be more than welcome!
    - Simon

    I tried the "panel.paint(Canvas.getGraphics());". However, I still don't have anything printed. My code is as follows.
    JFrame frame = new JFrame("FrameDemo");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setPreferredSize(new Dimension(300, 200));
    jp = new JPanel();
    jp.setPreferredSize(new Dimension(300, 200));
    gpc = MyPlotCanvas.createPlotCanvas();
    Canvas c = gpc.getGraphicsCanvas();
    jp.paint( c.getGraphics() );
    frame.add(jp);
    frame.setSize(600, 500);
    frame.show();

  • SWING or AWT

    Hi, i'm new in Java. I need to develop an application and i need to make some forms.
    What API should i use? AWT or SWING. What are the differences betwen these two?
    I would appreciate if somebody could give me more info or a link about this topic.
    Regards, thanks everybody.

    olivarespablo,
    It's a long story, but here's the gist: AWT was Java's original drawing library. While AWT stands for "Abstract Windowing Toolkit," it was joked of as the "Awkward Windowing Toolkit" for its less-than-desired GUI abilities. Also AWT widgets were based on widgets native to each platform, and were designed as a thin layer over native widgets. This thin layer was supposed to provide the "abstraction" that would allow cross platform GUI building.
    It turned out in practice that this abstraction layer was often difficult to implement, and restricted designers to whatever was common among different platforms. Hence, the Java 1.2 release included an all-Java GUI widget library called "Swing".
    Here's where things stand: only AWT is supported natively by most browsers; thus, if you want to build applets, AWT is your choice. Browsers can run Swing applets, but that usually requires that the Swing Browser Plugin, and that's something you can't guarantee a user will have.
    If you're writing a desktop application, Swing would be your natural choice.
    For more info, see this page:
    http://java.sun.com/docs/books/tutorial/uiswing/
    That's the Swing tutorial. The bottom of the page contains a link to the old AWT tutorial.
    Also search the 'Net for more articles--you'll likely need to read more than just the tutorials above to get a solid overview of how the pieces fit together.
    --A                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Swing Multi-Thread Question. Is this safe?

    I want to use a Thread to get data from db and put it into my TableModel.
    This doesn't update the GUI directly but causes a fireTableChangedEvent... to be called which will ultimately cause the GUI to be updated.
    Question: Can I therfore use a plain Thread for this or must I use a SwingWorker?

    And now understand that a plain Thread is totally
    unnaceptable (which answers my original question),
    could you clarify the code below would be an
    alternative solution to my problem or if there is some
    reason why I MUST NOT use this:
    final SwingWorker worker = new SwingWorker()
    List data = null;
    public Object construct()
    data = dataFetcher.getDate();
    return null;
    public void finished()
    myTableModel.add(data);
    myTableModel.fireTableDataChanged();
    worker.start();
    Written this way, SwingWorker is fine, will update the model in the AWT thread.
    However, be careful of one thing: the code after worker.start() is executed immediately, which means concurrently with DataFetcher.getDate() and maybe before (or after) myTableModel.add(data).
    Of course this applies to who is calling the code above and so on.
    In other words you must be 100% certain that no application code is executed after worker.start() nor here nor up in the stack frames.
    Foxtrot will block there, guaranteeing you a correct behavior and no nasty surprises. Big gain in reducing complexity and improve mantainability IMHO.
    Simon

  • Swing vs AWT

    Why and when should you use one over the other?

    Does anyone use AWT visual components anymore?I guess that's more like what I'm asking. Graphics is
    AWT, yes? Meaning things like drawRect, drawLine,
    setFont are also AWT. Although I'm guessing there are
    swing counterparts to those.AWT is low level stuff ([java.awt.]Graphics, Image)
    AWT is a select of imate manupilation tools (BufferedImage, ImageFilter)
    AWT is a heavy weight Windowing Toolkit
    Swing is a light weight windowing toolkit, build on top of AWT (the low level stuff, and four (or so) "heavy weight" components (namely Window, Frame Dialog and Container).

  • 2 very easy AWT questions, please help

    Hello, hopefully one of you AWT Pros can help me out, im pretty new to AWT (i cannot use swing since my awt doesnt support it)
    (1) I have a center panel that display a pic "map.gif". It is currently on the upper left hand corner, how can i properly Center this pic?
    (2)I have a bottom panel that is a label to display a status bar. How do I change the background color from white/black text --> black/white text?
    I tried using something like:
    Label statusBar = new Label();
    statusBar.setBackground(color.black);  //and I also tried .....(black)
    statusBar.setForground(color.white);     //and I also tried ....(white)but i just get errors that say: <identifier> expected, and "cannot resolve symbol"
    any help would be great, thanks!!

    (1) You have to center the Image manually, for example:
    public class ImagePanel extends Panel
    { Image image=null;
    int imgWidth=0,imgHeight=0;
    public ImagePanel(Image img)
    { super(); 
    image=img;
    imgWidth=image.getWidth(this);
    imgHeight=image.getHeight(this);
    public void paint(Graphics g)
    { Dimension d=getSize();
    int x=(int)(d.width-imgWidth)/2;
    int y=(int)(d.height-imgHeight)/2;
    g.drawImage(image,x,y,this);
    (2) Label lb=new Label("Blah");
    lb.setForeground(Color.black);
    lb.setBackground(Color.white);

Maybe you are looking for

  • New Airport express not finding wireless network

    I just got a new AX plugged it in it was recognized did the set up and said to update. It went through the update but the amber light kept flashing. After the update I also lost my internet connection. I have to re-establish my internet connection ea

  • Facebook notifications while using seperate email folders?

    I don't use the primary message folder because I like my emails seperate. When I get a Facebook notification via email, it would typically be intercepted by the FB app and would go to the location on the FB app (Like messages or notifications). This

  • Why is exported file coming up read-only in Adobe Acrobat 9 pro?

    Hi. Would appreciate  whatever help anyone can give me. I spent the last 2-3 weeks  working on a scientific poster for my brother, who is a doctor. I did  the work in Adobe.com and came to the realization I was not going to be  able to save it outsid

  • How does this IMPORT statement works

    can any one tell me how does this statement will work.. I am wokring on Solution manager system , where in there is a function module SSF_FIELD_LIST to which system passes form name.   import fields to fieldlist          from database stxfcontr(sf) i

  • How to pass a xml CDATA in string element when OSB calling a webservice?

    How to pass a xml CDATA in string element when OSB calling a webservice? I have a business service (biz) that route to operation of a webservice. A example of request to this webservice legacy: <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.