Book Recommendation for Building Swing Applications

I'm looking for recommendations on books for building swing applications from the ground up.
I'm not a strong GUI developer. 95% of my experience has been strictly on back end development in many other languages. What little GUI experience I have has been with C++ (years ago) and most recently with HTML.
I know what I want to develop, and even have the GUI design for my application drawn out. I just need a good book that can walk me through developing the interface in Java.
I already have several books on Java. But, I find them somewhat limiting because they don't help me build the app from the ground up.
Yes, I've tried the online book on the Sun site, "The Jfc Swing Tutorial: Guide to Constructing Gui's".
Please offer some recommendations and reasons on why you like the book.
Thanks.

A few comments to that ....
the first thing is understanding the LayoutManagers, that are available.
I will give you a short guideline where they are usefull:
FlowLayout - usefull for JLabel-JTextField combinations or several JButtons
BorderLayout - usefull for the structure of basic containers
CardLayout - usefull for every area of the screen, where you want to appear different panels
GridLayout - usefull for a group of same-sized components laid out in a grid
GridBagLayout - usefull for a group of components, that have different sizes, very flexible
JTabbedPane - a special container, that is similar to CardLayout but with visible tabs to switch panels
Normally you can say "I want that group at the bottom of the frame, that other group at its left side, that toolbar at its top" - if you can say so - that shouts for BorderLayout. If you can say "in this area I want to use several panels" that means CardLayout or a JTabbedPane.
You see, if you have an idea, what the LayoutManagers do, you know exactly which area needs what Layout - so you have a guideline, which LayoutManager to use in that panel.
To make an example:
You want 3 buttons centered at the bottom of a frame - this 3 buttoms should be of that size, that is needed by the button texts. So, what to do:
1. create a JPanel with FlowLayout
2. create the buttons and add it to that JPanel
3. create another JPanel with BorderLayout
4. add that first JPanel to the second JPanel at BorderLayout.CENTER
5. add this Panel to the ContentPane of the frame at BorderLayout.SOUTH
that is a simple panel in panel construct - placing 3 buttons centered at the bottom of the frame. You have to play with that different LayoutManagers a little bit - the way you stick one panel in another changes the look of the GUI - if you know, how it changes (by playing with the examples of the tutorial), you will have that "from the ground"-experience, you are looking for - believe me.
greetings Marsian

Similar Messages

  • Problems installing Xcode for building iPhone applications

    Just got a mac mini today for building iphone applications. I'm new to macs.
    Downloaded the iPhone SDK. Installed it. But I saw there are a lot of
    packages. Do I need to install them all? I've installed the iPhone ones.
    When I launch Xcode I get the 'Welcome to Xcode 3.1', which just looks like
    a lot of tutorials. How do I run the Xcode application to build iPhone apps?
    Cheers,
    John.

    you just install XCode and it will install ALL packages, the packages that you see are to be installed one by one for expert users or users that want to have a the newest packages.
    Remember: Install the iPhone SDK 2.2
    you just go to menu and click File > New Project > iPhone and choose the type of project for the iPhone that you want to use, WebApp, UIApp, etc ...
    because you are new to the MAC world and probably never used Objective-C in your live, it is good to start somewhere first, buy a good book of the subject, start with the language (Objective-C) them learn about the framework (Cocoa Touch) and then read all about XCode.
    In the meanwhile you can check several websites to start knowing what you going to be able to do one day, here are some examples:
    - Writing your first iPhone application (payed movies, first for free)
    - iPhone Developer Central
    - Apps Amuck
    - iPhone SDK Articles
    remember that you will need to apply to the iPhone Developer Program in order to submit your SDK Apps to the Apple AppStore.
    Updated: You can find several movies on YouTube on how to start building apps to the iPhone, but the most seams to do a bad job cause they are screen casting the entire desktop rather the area that we need, so text will be unreadable on such dimensions.

  • BackGround picture for a Swing application??

    hi,
    once I got a nice idea while watching some webpages. we can give a background picture for a webpage in <body> tag?
    I want to do same thing for any Swing application. Currently I am working on that issue. Any suggestions are welcome!!
    santhosh

    Hi everybody!
    Finally I got it. now Using this We can enable background for any swing application.
    the complete code is shown here. If you have any problems regarding this code, please mail to [email protected]
    /******************************[TexturedImageIcon.java]***********************/
    import java.net.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.geom.*;
    import java.awt.image.*;
    import javax.swing.*;
    /* this is used to generate a tiled image from a given image file.*/
    public class TexturedImageIcon extends ImageIcon
         private Dimension size = new Dimension(10, 10);
         BufferedImage bimg1,bimg;
         Graphics2D g2;
         ComponentListener cl = new ComponentAdapter(){
              public void componentResized(ComponentEvent ce){
                   Component c = (Component)ce.getSource();
                   size = c.getSize();
                   createImage();
         public void setImage(String filename){
              super.setImage(new ImageIcon(filename).getImage());
              bimg1=null;
              createImage();
         public TexturedImageIcon(Component comp, Image img){
              super(img);
              addListener(comp);
         public TexturedImageIcon(Component comp, String filename){
              super(filename);
              addListener(comp);
         public TexturedImageIcon(Component comp, URL url){
              super(url);
              addListener(comp);
         private void addListener(Component comp){
              comp.addComponentListener(cl);
         private void createImage(){
              bimg = new BufferedImage(size.width, size.height, BufferedImage.TYPE_INT_RGB);
              g2 = bimg.createGraphics();
              Rectangle2D rect = new Rectangle2D.Float(0,0,size.width-1, size.height-1);
              Rectangle2D tr = new Rectangle2D.Double(0,0,super.getIconWidth(), super.getIconHeight());
              if(bimg1==null){
                   bimg1 = new BufferedImage(super.getIconWidth(), super.getIconHeight(), BufferedImage.TYPE_INT_RGB);
                   Graphics2D g = bimg1.createGraphics();
                   g.drawImage(super.getImage(), null, null);
              TexturePaint tp = new TexturePaint(bimg1, tr);
              g2.setPaint(tp);
              g2.fill(rect);
         public int getIconWidth(){ return size.width; }
         public int getIconHeight(){ return size.height; }
         public Image getImage(){
              System.out.println("asked");
              return bimg;
         public void paintIcon(Component c, Graphics g, int x, int y){
              Graphics2D g2d =(Graphics2D)g;
              g2d.drawImage(bimg, null, null);
         public static void main(String[] args){
              JFrame f = new JFrame();
              f.setSize(300,300);
              JLabel label = new JLabel();
              label.setBackground(Color.white);
              label.setBorder(BorderFactory.createRaisedBevelBorder());
              label.setIcon(new TexturedImageIcon(label, "world2.gif"));
              f.getContentPane().setLayout(new BorderLayout());
              f.getContentPane().add(label, BorderLayout.CENTER);
              f.show();
    /*********************************[JFCUtils.java]************************/
    /*The main logic to enable background picture lies in this class*/
    public class JFCUtils{
         public static ContainerListener cl = new ContainerAdapter(){
              public void componentAdded(ContainerEvent ce){
                   JComponent child = (JComponent)ce.getChild();
                   child.setOpaque(false);
                   child.addContainerListener(this);
                   addlisteners(child);
         public static TexturedImageIcon enableBackGround(JFrame f, String filename){
              ((JPanel)f.getContentPane()).setOpaque(false);
              JLayeredPane lp = f.getLayeredPane();
              JLabel label = new JLabel();
              TexturedImageIcon icon = new TexturedImageIcon(label, filename);
              label.setIcon(icon);
              JPanel panel = new JPanel(new BorderLayout());
              panel.add(label, BorderLayout.CENTER);
              lp.add(panel, new Integer(Integer.MIN_VALUE));
              Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
              panel.setBounds(0, 0, screen.width,screen.height);
              addlisteners((JComponent)f.getContentPane());
              return icon;
         private static void addlisteners(Component c){
              c.toString();
              if(c instanceof JComponent) ((JComponent)c).setOpaque(false);
              if(c instanceof Container){
                   Container ct = (Container)c;
                   ct.addContainerListener(cl);          
              for(int i=0; i<ct.getComponentCount(); i++){ //recursivly make all subcomponents transparent
                   Component child = (Component)ct.getComponent(i);
                   addlisteners(child);
         public static void main(String[] args){
              JFrame f = new JFrame();
              enableBackGround(f, "bg.jpg");
              JButton b = new JButton("fdfdfdfd");
              f.getContentPane().add(b, BorderLayout.NORTH);
              f.setSize(300,300);
              f.show();
    /*************************************[UserDialog.java]**************************/
    //to check how a swing application with background looks like
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.event.*;
    public class UserDialog extends JDialog
         JPanel contents = (JPanel)getContentPane();
         JTextField shortField = new JTextField(20);
         JTextField nameField = new JTextField(20);
         JTextField emailField = new JTextField(20);
         JTextField smtpServerField = new JTextField(20);
         JTextField pwdField = new JPasswordField(20);
         JTextField pwdField1 = new JPasswordField(20);
         boolean okay = false;
         public UserDialog(JFrame owner){
              super(owner, "New User Details", true);
              initComponents();
              pack();
              setResizable(false);
         public UserDialog(JDialog owner){
              super(owner, "New User Details", true);
              initComponents();
              pack();
              setResizable(false);
         private void initComponents(){
              JPanel west = new JPanel(new GridLayout(0, 1));
              west.add(new JLabel("Short Name"));
              west.add(new JLabel("Full Name"));
              west.add(new JLabel("Email"));
              west.add(new JLabel("SMTP Server"));
              west.add(new JLabel("Password"));
              west.add(new JLabel("Confirm Password"));
              JPanel east = new JPanel(new GridLayout(0, 1));
              east.add(shortField);
              east.add(nameField);
              east.add(emailField);
              east.add(smtpServerField);
              east.add(pwdField);
              east.add(pwdField1);
              JPanel south = new JPanel();
              JButton ok = new JButton("Ok");
              JButton cancel = new JButton("Cancel");
              south.add(ok);
              south.add(cancel);
              contents.setBorder(JFCUtils.border);
              contents.setLayout(new BorderLayout(10, 10));
              contents.add(west, BorderLayout.WEST);
              contents.add(east, BorderLayout.EAST);
              contents.add(south, BorderLayout.SOUTH);
              ActionListener al = new ActionListener(){
                   public void actionPerformed(ActionEvent ae){
                        okay = ae.getActionCommand().equals("Ok");
                        setVisible(false);
              ok.addActionListener(al);
              cancel.addActionListener(al);
         private void clearFields(){
              shortField.setText("");
              nameField.setText("");
              emailField.setText("");
              smtpServerField.setText("");
              pwdField.setText("");
              pwdField1.setText("");
         public User getUser(){
              clearFields();
              okay = false;
              show();
              if(okay) return new User(shortField.getText(), nameField.getText(), emailField.getText(), smtpServerField.getText(), pwdField.getText());
              else return null;
         public static void main(String[] args){
              Dialog dlg = new UserDialog();
              TexturedImageIcon ticon = JFCUtils.enableBackGround(f, "bg.jpg");.show();
              //we can change the background picture by calling ticon.setImage(...) at runtime.

  • Accelarate the Linux ATI Graphics card  for java Swing application

    Hi All,
    I am using a ATI Radeon 9550 Graphic card in LFS (Linux from the scratch) environment. I want to enable the OpenGL-based pipeline for Java Swing application. I tried the -Dsun.java2d.opengl=true . But the Java swing application getting very slow.
    How to overcome this problem?
    Any one give the procedure to Accelerate ATI graphics card for Java Swing Application
    How to verify Java swing use ATI graphics card ?
    Thanks in advance..
    Prabhu.S

    Hi All,
    I am using a ATI Radeon 9550 Graphic card in LFS (Linux from the scratch) environment. I want to enable the OpenGL-based pipeline for Java Swing application. I tried the -Dsun.java2d.opengl=true . But the Java swing application getting very slow.
    How to overcome this problem?
    Any one give the procedure to Accelerate ATI graphics card for Java Swing Application
    How to verify Java swing use ATI graphics card ?
    Thanks in advance..
    Prabhu.S

  • Book Recommendation for Fathers Day?

    I'm waiting for Illustrator CS4 Wow! to come out here in the UK as my next book purchase and I already have a couple of basic manual replacement books which I am steadily ploughing through.  I wonder if anyone could suggest a couple of titles I could give to my kids to distract them from the inevitible cheap aftershave alternative?
    I would like either a book that discusses more intermediate issues in Illy rather than the kind of very basic manual replacement books or if you're up for it, suggest a couple of illustration techniques that might be useful and help with my drawing.  I realised pretty quickly that a) Photoshop isn't good at taking your photos, b) Dreamweaver isn't that good at writing your code and c) Illustrator isn't up to drawing your drawings - Maybe a clickable "Inspiration Panel" should be a feature request?
    So either any recommendations for drawing techniques that would be useful for digital art and/or recommendations for interemediate level Illustrator techniques?
    Many thanks
    Martin

    Thanks for the suggestion but that's one of the books I already have
    and think it's one of the best Adobe Software help books I have out of
    all of them.  It's really well written and covers a lot of material in
    a practical way.  The other Illustrator book I have is by Deke
    McClelland which I find to be more like a reference manual than Mordy
    Golding's.
    Martin
    >--Original Message--
    >From: [email protected]
    >Date: 10/06/2009 15:25
    >To: "Martin Coleman"<[email protected]>
    >Subj: Book Recommendation for Fathers Day?
    >
    >Mordy Goldings Real World Adobe Illustrator CS 4

    >http://www.amazon.com/Real-World-Adobe-Illustrator-CS4/dp/0321573552

    >Mordy has a very clear way of writing.
    >

  • Book recommendation for database applications

    I'm a LabView newbie.  My primary work will be file and data manipulation using the database connectivity toolset.  Are there any books available to help with database applications?
    Thanks

    Hello Paul,
    I cannot offer much recommendation on books about development of database
    applications from the database end (though user ratings through places like
    Amazon have usually treated me right).   If you are interested in
    learning more about how the Database Toolkit for LabVIEW can be used, the Database Connectivity Toolkit
    Manual is a great (and comprehensive) resource.
    Hope this helps!
    Travis M
    LabVIEW R&D
    National Instruments

  • Standards Recommendations for build applications

    Hello, I'd like to know if there is some "Standards & Guidelines" document to build applications using HTMLDB. I know there are How-tos, etc, is there any document that explain or describes techniques or standards to build better applications?
    Thanks!
    Daniela

    I found some interesting stuff here, besides the user's guide.
    http://www.oracle.com/technology/products/database/htmldb/pdf/B14377_01.pdf
    You can find the tutorials and how-tos here:
    http://www.oracle.com/technology/products/database/htmldb/index.html
    Bye,
    Flavio

  • Best way for building an application main frame

    I'm about to program a desktop application.
    The main frame will have menus, toolbar, status bar etc.
    There will be a lot of interaction between the menus, toolbar buttons and other custom gui components (such as an editor).
    My question is which is the best way for building it.
    Cramming all the code in one class file is out of the question.
    I thought about making my own custom JFrame and add API functions like for it so different GUI elements can be accessed.
    Each component which will be manipulated will be in its own class file with the constructor accepting a reference to my custom JFrame object which it is contained in.
    Any suggestions on the matter would be of great help since I've never done extensive Swing programming before.
    P.S.
    The application makes extensive use of RMI.
    What considerations should I take into account (except using SwingUtilities.invokeLater()) ?

    Hi,
    I have replied on this subject somewhere else today but what I do is have one simple entry point where I just instanciate a JFrame.
    On that frame I have a main JPanel. On that panel I add new objects like JPanels, tabs etc.
    I keep each new panel in a separate source as it is easier when the application grows, and it will. That also means that several programers can work with the same application without interfearing each other.
    I hope you understand what I mean the the thing is to split up the code into several sources.
    It may not suit everyone but I found this approach to be the best for me.
    Klint

  • Best setup for a swing application

    Hello,
    I have developed an Swing application for a EPOS machine.
    The machine has around 512 ram.
    What's the best setup for me in terms of performance, for example, which JVM to use etc.....
    Cheers
    Bobby

    bsbiran wrote:
    Hi,
    Well the app require alot of images and I parts of it do run 'slow'
    ...I'm currently going through a book about Swing and read that many times the "slowness" of a Swing-application can be credited to the programmer for not using the API efficiently/correctly (letting the app repaint too much, or repainting large parts that don't need repainting at all, to name just two things). So, I don't know how much of a Swing-guru you are, but it might be better to read a few decent Swing tutorials or pick up a good Swing book.

  • Javaw does not work for my SWING application

    Dear all,
    I try to use 'javaw ClassName' (from a batch test.bat) to hide command prompt window when a Swing application starts. Unfortunately, the CMD still appears. So I recommend the command java and javaw has no difference in my situation.
    I use jdk1.6.0_02 runs on Windows XP Prof Service Pack 2.
    Could anyone give me some hint please?
    Regards,
    Byron
    The Swing code is attached
    import java.awt.*;
    import javax.swing.*;
    public class Reminder extends JFrame
         public static void main(String[] args)
              new Reminder();
         public Reminder()
              super("Reminder");
              JDesktopPane desktop = new JDesktopPane();
    this.setContentPane(desktop);
    this.setLocation(350, 300);
    this.setSize(300, 80);
    this.setResizable(false);
    JLabel reminder = new JLabel("Do not forget delivering reports!", SwingConstants.CENTER);
    reminder.setForeground(new Color(125, 125, 220));
    reminder.setFont(new Font("SansSerif", Font.BOLD, 18));
         this.getContentPane().setLayout(new BorderLayout());
         this.getContentPane().add("Center", reminder);
         this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);// set frame closeable
    //     this.setExtendedState(JFrame.MAXIMIZED_BOTH);// set maximized frame
              this.setVisible(true);
    }

    Hi Andrew,
    In my case, it does not require any web server. I could not use javaws.
    There is way work around by using Runtime.exec(). The MS Windows CMD hides when I double click the start.bat file.
    File start.bat:------------------------------------------------------------------------------------
    java Test
    File Test.java:-----------------------------------
    public class Test
         public static void main(String[] args)
              try{
                   Runtime r = Runtime.getRuntime();
                   r.exec("java Reminder");
              }catch(Exception e)
                   e.printStackTrace();
    File Reminder.java has been attached in the original post.
    Regards,
    Byron

  • How to disable html for whole swing application.

    Hi,
    As we can disable html for individual swing components , for example JLabel
    label.putClientProperty("html.disable",Boolean.TRUE);
    BasicHTML.updateRenderer(label,"html.disable");
    is there any way to disable html rendering in swing components for system wide / whole application?.
    Thanks
    Kiran

    Better use a utility method in the application like this
    public static void disableHtml(JComponent component)
    component.putClientProperty("html.disable",Boolean.TRUE);
    BasicHTML.updateRenderer(component,"html.disable");
    call disableHtml(Component u want to set html disable) for any component in the application.

  • Design Patterns for java swing application front a J2EE server

    Hi,
    i dont nkow that i stay in the correct forum. I am development a java swing client application, no web, and i dont know that if there are any patterns for a client of this type.
    I have readed http://java.sun.com/blueprints/corej2eepatterns/Patterns/index.html
    but after of Buissnes Delegate pattern, the others one, over ejb tier, are applicated only for web clients, using servlets and jsp pages.
    If i have a swing client application, what patterns i must folow for implement the client logic of my swing application??
    thanks

    MVC pattern is one of the most used
    http://en.wikipedia.org/wiki/MVC
    http://csis.pace.edu/~bergin/mvc/mvcgui.html
    ...

  • Book recommendation for Content Networking?

    Hi,
    Is there any books outhere on cisco CSS, GSS for a good readup?
    I know there's a whole lot of docs fr univercd, but was wondering if there are actually books on these products?
    Thanks.

    Thank you for your book recommendation. This sounds like an excellent book for learning Flash. From the description on Amazon, the emphasis of this book is on learning Flash with just a little information about ActionScript 3. Perhaps there is enough ActionScript 3 information in this book to get a good foundation with ActionScript, to learn the terminology and syntax?

  • Book recommendation for newbie

    I know the basics of Flash CS4, and would like to extend my knowledge by learning about ActionScript 3. My background is in graphic design (not math, not programming). Can anyone help with a book recommendation that would get me started with the basics of ActionScript 3?

    Thank you for your book recommendation. This sounds like an excellent book for learning Flash. From the description on Amazon, the emphasis of this book is on learning Flash with just a little information about ActionScript 3. Perhaps there is enough ActionScript 3 information in this book to get a good foundation with ActionScript, to learn the terminology and syntax?

  • What kind of licensing is required for using Adobe Flex Builder IDE for building Flex Applications?

    I am looking for an IDE to build Flex Applications. Can you suggest what IDE to be used for this and what are the licensing I should procure for the same? What kind of support will be available with that license?

    Thanks Empardopo.  Do you have any suggestions? What kind of problems do you see with this tool. Also does Flash Builder 4.7 supports Flex SDK 3.5?

Maybe you are looking for

  • Emulator 8.1 not working on windows 8.1 single language

    Hi,  I am facing a problem and also I spent many days and night to resolve. I am working visual studio 2013 visual C# to create mobile apps, the problem is when I run the code I got an error pending an emulator, after searching on net I got the follo

  • Error while posting GR "Internal error in FORM/FUNCTION CKML_F_BUILD_INDEX

    Dear Experts, While posting GR for any non-valuated material, I am getting an error "Internal error in FORM/FUNCTION CKML_F_BUILD_INDEX in position 1 with RC 0 Message no. C+099" Kindly explore the possibilities of solution for the above error. The a

  • Hebrew language on my mobile

    Hi all, I have a problem to write the screens on the mobile and to display the data also in Hebrew, There is only way on English. How can I do that. I'm developing my application in NetBeans 4.1 Please help...

  • Unable to update bootcamp in windows 7 enterprise

    I'm using Windows 7 Enterprise and bootcamp 3.0 on my MacBook. Problems is I can't update to bootcamp 3.1 manually or by software update. What's wrong

  • Process abstraction for frames reusability

    I write a modular desktop application that consists of two parts: manager and worker. Both use one frame called ModuleSelectionFrame. Each program can do common processes like creating or editing some entities using modules. Each process can be divid