Learning swing gui by hand or gui builder?

Hello,
Which is a better way of start learning writing swing gui based apps? by hand or using gui builder?
Do you know any useful web links? or do you consider buying books?
Thanks.

>>
Hmm, the differences:
1) The GUI builder app resizes correctly.-->>falseJust stating it is false doesn't make it so. I never have any issues with my GUI builder apps resizing correctly. I do have issues making my coded by hand apps resize correctly. Ignorance on my part? Possibly
I used to use a GUI builder just for complicated layouts and use GridBagLayout for simple dialogs inside an app, but I find myself just using a GUI builder now. Just much quicker and much less hassle.
As far as maintaining the code if you use the GUI builder for maintanence where is the issue?
i have never seen a GUI builer that uses
layoutmangers please point me to the one that you are
using i would love to take a look
secondly have you seen tried the little exersise you
will be suprised at how complex the code is compared
to the one done by hand!!!!IntelliJ's GUI builder appears to use a custom GridLayout manager, the code it generates appears pretty straightforward to me, doesn't seem overly complicated:
private void $$$setupUI$$$() {
        mainPanel = new JPanel();
        mainPanel.setLayout(new com.intellij.uiDesigner.core.GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1));
        final JSplitPane splitPane1 = new JSplitPane();
        splitPane1.setContinuousLayout(true);
        splitPane1.setDividerLocation(142);
        mainPanel.add(splitPane1, new com.intellij.uiDesigner.core.GridConstraints(0, 0, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_CENTER, com.intellij.uiDesigner.core.GridConstraints.FILL_BOTH, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, null, new Dimension(200, 200), null));
        fileListing = new JTree();
        splitPane1.setLeftComponent(fileListing);
        tabPane = new JTabbedPane();
        splitPane1.setRightComponent(tabPane);
        renameTab = new JPanel();
        renameTab.setLayout(new com.intellij.uiDesigner.core.GridLayoutManager(2, 7, new Insets(0, 0, 0, 0), -1, -1));
        tabPane.addTab("Untitled", renameTab);
        final JLabel label1 = new JLabel();
        label1.setHorizontalAlignment(4);
        label1.setText("Current Filename");
        renameTab.add(label1, new com.intellij.uiDesigner.core.GridConstraints(1, 0, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_WEST, com.intellij.uiDesigner.core.GridConstraints.FILL_NONE, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, null, null, null));
        imageScrollPane = new JScrollPane();
        imageScrollPane.setHorizontalScrollBarPolicy(30);
        imageScrollPane.setVerticalScrollBarPolicy(20);
        renameTab.add(imageScrollPane, new com.intellij.uiDesigner.core.GridConstraints(0, 0, 1, 7, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_CENTER, com.intellij.uiDesigner.core.GridConstraints.FILL_BOTH, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_WANT_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null));
        currentFilenameField = new JTextField();
        renameTab.add(currentFilenameField, new com.intellij.uiDesigner.core.GridConstraints(1, 1, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_WEST, com.intellij.uiDesigner.core.GridConstraints.FILL_HORIZONTAL, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_WANT_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null));
        final JLabel label2 = new JLabel();
        label2.setText("New Filename");
        renameTab.add(label2, new com.intellij.uiDesigner.core.GridConstraints(1, 2, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_WEST, com.intellij.uiDesigner.core.GridConstraints.FILL_NONE, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, null, null, null));
        newFilenameField = new JTextField();
        renameTab.add(newFilenameField, new com.intellij.uiDesigner.core.GridConstraints(1, 3, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_WEST, com.intellij.uiDesigner.core.GridConstraints.FILL_HORIZONTAL, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_WANT_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null));
        renameButton = new JButton();
        renameButton.setText("Rename");
        renameTab.add(renameButton, new com.intellij.uiDesigner.core.GridConstraints(1, 4, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_CENTER, com.intellij.uiDesigner.core.GridConstraints.FILL_HORIZONTAL, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, null, null, null));
        previousButton = new JButton();
        previousButton.setText("");
        renameTab.add(previousButton, new com.intellij.uiDesigner.core.GridConstraints(1, 5, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_CENTER, com.intellij.uiDesigner.core.GridConstraints.FILL_HORIZONTAL, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, null, null, null));
        nextImageButton = new JButton();
        nextImageButton.setText("");
        renameTab.add(nextImageButton, new com.intellij.uiDesigner.core.GridConstraints(1, 6, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_CENTER, com.intellij.uiDesigner.core.GridConstraints.FILL_HORIZONTAL, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, null, null, null));
        htmlGeneratorTab = new JPanel();
        tabPane.addTab("Untitled", htmlGeneratorTab);
    }

Similar Messages

  • JavaFX Visual GUI Builder - not using FXML - only based on pure Java

    The decision to provide a pure Java based JavaFX API activates the pure Java people who where FXML resistent in the past.
    JavaFX is the future ... the last few month when I check the new possibilities I came slowly but surely to this opinion...
    The Scene Build is still based on FXML. So ... for the pure Java developer there is no advantage to use it ... only to see what components are available in the JavaFX standard I see no advantage for me to use it. I won't create JavaFX clients based on FXML.
    What's the future plan...is there a Project in the World who want to provide a Visual GUI Builder who produce pure Java based JavaFX Code like Eclipse Window Builder do it for Swing or SWT or JBuilder for Swing many years ago.
    That's the main reason that JavaFX get successful in the future. A software architect who has to decide using JavaFX as the new Company Standard...will never do it without stomachache.
    Do I miss some news?
    Is there are NetBeans Version who can do it or a plugin I don't now?
    Edited by: 984992 on 30.01.2013 14:24
    Edited by: 984992 on 30.01.2013 14:30

    I don't think you are getting it, or just making a big deal about it.
    Currently SceneBuilder is connected to Netbeans using the FXML. It's not hard at all, nor is there a big issue. In the next few years Scenebuilder will be in Netbeans integrated, so it will be just like the swing gui builder. FX is still new, from a scripting lang, to a super powerful lang. FXML uses so little code.... Also you can do things either with, or without FXML, FXML IS NOT NEEDED IN FX AT ALL, only limited on Scene Builder.
    This is the FXML I am using for a dice game I am creating. Not much at all.
    <?xml version="1.0" encoding="UTF-8"?>
    <?import java.lang.*?>
    <?import java.util.*?>
    <?import javafx.collections.*?>
    <?import javafx.scene.chart.*?>
    <?import javafx.scene.control.*?>
    <?import javafx.scene.image.*?>
    <?import javafx.scene.layout.*?>
    <?import javafx.scene.paint.*?>
    <BorderPane fx:id="border" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="785.0" prefWidth="1518.0" xmlns:fx="http://javafx.com/fxml" fx:controller="ZonkController">
    <left>
    <AnchorPane minHeight="86.0" minWidth="62.0" prefHeight="390.0" prefWidth="768.0">
    <children>
    <Button fx:id="button" layoutX="126.0" layoutY="90.0" onAction="#handleButtonAction" text="Click Me!" />
    <Pane fx:id="pane" layoutX="737.0" prefHeight="390.0" prefWidth="211.0" />
    </children>
    </AnchorPane>
    </left>
    <right>
    <AnchorPane prefHeight="386.0" prefWidth="460.0">
    <children>
    <BarChart fx:id="barChart" layoutX="7.0" layoutY="-10.0" prefWidth="460.0">
    <xAxis>
    <CategoryAxis fx:id="names" side="BOTTOM" />
    </xAxis>
    <yAxis>
    <NumberAxis fx:id="scores" side="LEFT" />
    </yAxis>
    </BarChart>
    </children>
    </AnchorPane>
    </right>
    <top>
    <ImageView fx:id="iv" fitHeight="394.24998969072755" fitWidth="525.6666641235352" pickOnBounds="true" preserveRatio="true" BorderPane.alignment="TOP_CENTER" />
    </top>
    </BorderPane>
    It is all codecompleted like a class normally would, so there is nothing to worry about :)
    .CSS isn't hard either.

  • GUI Builder: Where to get Icons for Swing components

    Hi,
    I am creating a GUI Builder for Swing GUIs and I am searching for icons representing Swing Components as seen in many GUI Builders like JBuilder.
    So I want to have ToggleButtons with icons in a toolbar, to let the user choose what Swing Component to create (e.g. JTextField, JList, etc.).
    Are there any free icons for Swing Components?
    Thank you very much for your help.
    Regards,
    Alex

    Hi ipooley,
    thanks for this reply but I know that page already.
    What I am searching for are icons of JComponents like JButton or JTextField etc. . You can see them for example in some GUI builders like JBuilder-Designer and they are looking as if they are Java native.
    Regards,
    Alex

  • Any Java GUI Builder, please?

    Hello everybody!
    I have to develop a GUI in Java and I am totally rookie on this (Java & GUI development). What I would like to know is whether there is a kind of GUI Builder for Java with free license. I mean, a program which makes me easier to choose where to put the different menus and buttoms of the GUI.
    I explain you a bit more. The IDE that I have to use is Eclipse. The GUI that I have to implement will be done in Java, but what I have to do is to convert a XML file in the GUI (read, parse?). This way I will be able to modify the XML using the GUI and then save the file again (this way the XML file will have been modified). I am working in a windows environment in spite of the GUI will be able to work in Linux too (thanks to a Java VM).
    Thank you very much for your answers! And remember, I need a free license program.
    Fran.

    Encephalopathic wrote:
    My rec: don't use a GUI builder. At your stage, using one will hinder your ability to learn Swing and will set your Java education back at least 6 months if not more. Learn to code Swing by hand. They're not bad to use once you understand Swing, but even then, most professionals that I know do not use them in professional products (they say that the "ugly code" produced can be hard to maintain), but use them mainly for quick prototyping.Couldn't agree more, and I'm not even close to a professional level. I started out with Matisse in Netbeans. I spent quite some time learning how to use Matisse to build a rather large GUI. I spent even longer wrestling with it to try to get it to place components where I wanted them and at the size I wanted them. Then, after all the time spent on building the GUI, I found that I had to start over again from scratch because the code it had generated was so unnecessarily huge and fragmented that adding in the application's functionality was simply not feasible. Not to mention that after a certain point, Netbeans consumed so much memory to keep track of all the GUI elements that it crippled my PC (~997MB RAM) soon after opening the project.
    So now I have to start over from scratch and have to hand-code it too. I would have been better off just starting by hand-coding in the first place. That way I wouldn't have lost so much time.
    Besides, If you have to build a parser that builds the GUI from the contents of an XML file, I don't think any GUI builder would be of any use to you. Surely you'd have to study swing to a degree where you can hand-code a GUI with ease if you want to have any chance of building a program that can build a GUI on your behalf based on arbitrary XML content.
    I could well be wrong because I'm still very much a beginner myself, but in my experience elsewhere I've always found that if you want to build a parser for something you're going to need to know whatever it is you're building a parser for like the back of your hand.

  • GUI builder for Eclipse

    Hello
    Does the IDE Eclipse provide a drag-and-drop GUI builder, can it create that MS visual studio feel, am new to java and just after some quick answers...any help will be much appreciated..
    cheers Lee

    Here are your quick answers:
    No Eclipse does not come with one, Eclpise barely comes with anything, you have to find a plugin for it.
    Yes there are several plugins for GUI drag and drop. I tried them and most outright suck, none even compare to Netbeans.
    Here are the quick answers you don't want to here but need to take to heart:
    If you choose to use the netbeans GUI builder as someone who is new to java, you will only be doing yourself a huge disservice. I am not saying this because I am anti netbeans, I used eclipse exclusively until about a year ago, now i prefer netbeans but still use eclipse on occasion. The reason i prefer netbeans is because of it's GUI builder. I love it, and I use it alot.
    So why am I suggesting you not use it? Simple really, I programmed GUIs using swing for years before using the GUI builder. I know swing very well, we are good buds. Because of this I am able to maximize the netbeans GUI builder to do amazing stuff with it quickly and easily. If I didn't know swing already, the Netbeans GUI builder would be a handicap and at the same time a crutch saving me from the handicap while keeping me handicapped.
    If you use the GUI builder before you know swing you will never be able to add to its palette or functionality, never be able to modify the autogenerated code, and learn more wrong swing practices than right ones. Yes it sucks to have to do something by hand when you know there is a tool that can do it. But you will be extremely thankful you invested the time learning swing first when you do start using the GUI builder.
    And I am not a fool, I know you are not going to listen to me, no one listens to just some guy saying you should do it the hard way first so you will be much better at doing it the easy way later. They all think either that they are special and can figure swing out while using the GUI builder, or that they will go back and learn it right later (as if they will have more time then). Listen if you want to, don't if you don't want to. If you do great, if not better job security for me. But everyone who doesn't winds up wishing they did, at least on this point.
    JSG

  • Developing a JAVA GUI builder

    Hi,
    I've been a middle tier and back end developer mostly, and i've not much development on swing. By that i mean i did not get much into swing programming other than using netbeans gui designer or jdeveloper for front end user interfaces. I have a general knowledge about swing though, how to create a custom component and stuff like that.
    However, i have a personal project for which i'd really like to build a gui designer for myself. I know that i can find my through if i dig hard enough, but that means a lot of time. Yes, i can use one the existing gui builders, but this time i want to add a little bit of experience to my swing programming skills, so that i can develop tools for my own development more easily.
    Looking around, i see a lot of gui builders, some being open source, but none of them gives me the impressing of being a good example for me. Some of them (like netbeans gui building code) seems to large to examine, and not many simple examples for this seem to exist.
    In general, there appears to be a lack of guidance for this kind of development. Swing development resources are plenty, but what about a little more custimized goals like mine ?
    I want to create a simple designer with swing, but certainly this kind of task has it's tricks ? How should i represent components (txtbox, listbox, etc) on the designer ? Do i use swing components directly in the designer ? Or do i create representations of them ? What are the tips and tricks for this kind of task ?
    So, what kind of resources can i use for making this task easier for me ? Which books would be helpful ? Or any online resources for getting up to speed for creating a simple gui designer in java?
    I hope i could express myself clear enoug, and It'd be really appreciated if anyone could contribute about my next step
    Best regards

    If you actually do go about creating a visual GUi builder, 90% of your code will revolve around using the java.beans package. So you should start learning that first.
    Here is an example of how to build a visual GUI builder using the java.beans package:
    https://bean-builder.dev.java.net/guide/tutorial.html
    http://java.sun.com/j2se/1.4.2/docs/api/java/beans/package-summary.html

  • What is the best FREE GUI Builder in Eclipse plugin??

    hello experts!!!
    nid ur help... does anyone here uses Eclipse editor?? i am using Jigloo Gui Builder plugin to create GUI
    BUT there GROUP layout manager it sucks its so diffucult to layout..
    what is the best FREE GUI Builder in Eclipse plugin??

    kagaw3000 wrote:
    i am not an english speaker and i am not an American citizen.And many others here are not primary or secondary English speakers either. How can you expect them to understand you if you use strange abbreviations? Programming is an exercise in precision. If you have a question here, you would do well to communicate it precisely.
    At the site [How to Ask Smart Questions|http://www.catb.org/~esr/faqs/smart-questions.html#writewell] :
    h1. Write in clear, grammatical, correctly-spelled language
    We've found by experience that people who are careless and sloppy writers are usually also careless and sloppy at thinking and coding (often enough to bet on, anyway). Answering questions for careless and sloppy thinkers is not rewarding; we'd rather spend our time elsewhere.
    So expressing your question clearly and well is important. If you can't be bothered to do that, we can't be bothered to pay attention. Spend the extra effort to polish your language. It doesn't have to be stiff or formal � in fact, hacker culture values informal, slangy and humorous language used with precision. But it has to be precise; there has to be some indication that you're thinking and paying attention.
    Spell, punctuate, and capitalize correctly. Don't confuse �its� with �it's�, �loose� with �lose�, or �discrete� with �discreet�. Don't TYPE IN ALL CAPS; this is read as shouting and considered rude. (All-smalls is only slightly less annoying, as it's difficult to read. Alan Cox can get away with it, but you can't.)
    More generally, if you write like a semi-literate boob you will very likely be ignored. So don't use instant-messaging shortcuts. Spelling "you" as "u" makes you look like a semi-literate boob to save two entire keystrokes. Worse: writing like a l33t script kiddie hax0r is the absolute kiss of death and guarantees you will receive nothing but stony silence (or, at best, a heaping helping of scorn and sarcasm) in return.
    If you are asking questions in a forum that does not use your native language, you will get a limited amount of slack for spelling and grammar errors � but no extra slack at all for laziness (and yes, we can usually spot that difference). Also, unless you know what your respondent's languages are, write in English. Busy hackers tend to simply flush questions in languages they don't understand, and English is the working language of the Internet. By writing in English you minimize your chances that your question will be discarded unread.
    the main issue here is my questionMy recommendation: learn to do Swing without a code-generator. You gain a much better understanding of the underpinnings of Swing, the layout managers, and you gain extremely good control of component placement.

  • Swing GUI components

    Hi, I'm starting to learn swing, and I'm trying to figure what components to use for my particular application. I'm preparing to build a gui that represents the status of hardware in realtime (ie this application regularly polls hardware and receives status data over a socket) I would like this to look like a grid in which a row and column junction represent a particular hardware status.
    I've been looking for a 'indicator' type of component, but can't find anything that fits the bill from the standard components.
    I've been thinking that one way to implement the gui is to create a grid of JPanel components, and change the background color of individual panels to reflect status. Is there away to group JPanels together?
    Any suggestions would be appreciated-
    Alan

    As CaptainMorgan has already pointed out, the JTable is probably a better component for what you are looking for. However, you can also group your JPanels by using the [url http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/BoxLayout.html]javax.swing.BoxLayout.

  • Swing GUI resizing

    Hello Users,
    I am writing a swing app for a 12 and 15 inch screen.
    When I create the JButtons for example, they have a
    Panel.add(jButton, new AbsoluteConstraints(10, 80, 70, 30));
    Obviously when the application is run on a 15 inch and I resize the frame the size of the buttons do not adjust.
    So my question is, if I develop a app for a 12 inch and want to show it on 15 inch is there a
    way to automatically resize the swing components?
    Regards,
    Bobby

    Hello Bobby,
    So you are saying set the frame size to the size of the screen?Yes. That's what you wanted to do, having the application frame adapted to the screen size, isn't it?
    But when I create a button don't I have to specify the X, Y length etc...?No, only if you use a null layout (which I guess is close to your Absolute thing).
    Can you provide a quick code example pleaseThere is nothing special. Give a frame a BorderLayout and put one or more buttons into a panel placed at the NORTH or SOUTH edge and see what happens when resizing the frame.
    I'm afraid you are using a GUI builder without having learned the basics.
    And since we have no idea how your GUI shall look like, it's difficult to make precise suggestions.
    Bye
    Jörg

  • The Great GUI Builder Mystery

    I am trying to create a GUI Builder using Java. I have searched high and low, low and high, and I have not been able to figure out how to set the design time behaviour of a JavaBean (or any component for that matter). Theoretically (according to the JavaBeans API) this is done using the setDesignTime() method, but how can I apply this to a javax.swing.JButton, for example?
    The BDK, and Bean Builder tools accomplish design time behaviour, but I am still unable to figure out how it is done (even after viewing the source code provided). (It appears as though those tools emulate design time behaviour.)
    Can someone give me some help or direct me to a place where I can find the help that I need?

    Ok.....
    Is there any way to make a swing component behave as if it is in design time mode?
    If I am completely lost, please give me a hint as to where I can find the information that I need.
    Please help!

  • Using JFileChooser in GUI Builder / Matisse

    Would appreciate any help with how to modify the code created by the NetBeans GUI Builder / Matisse to use jFileChooser.
    I've added a Menu item to act as a file Open option, called OpenItem, and the GUI builder has added a listener which points to a method OpenItemActionPerformed:
    private void OpenItemActionPerformed(java.awt.event.ActionEvent evt) {                                        
            // TODO add your handling code here:
    } I have also added a jFileChooser component, named jFileChooser1, but if I try to use it in the OpenItemActionPerformed method I get an error.
    private void OpenItemActionPerformed(java.awt.event.ActionEvent evt) {                                        
           JFileChooser1.  
    }     shows error: "<identifier> expected" (as soon as I get to the dot).
    The variable seems to be defined:
    private void initComponents() {
            jFileChooser1 = new javax.swing.JFileChooser();
    }// Variables declaration - do not modify
    private javax.swing.JFileChooser jFileChooser1;
    // End of variables declaration
    Maybe I have gone about this the wrong way, so any clues as to either how I can get the jFileChooser1 variable to work or any way I can use JFilechooser with GUI Builder created application would be much appreciated.
    Thanx in advance.

    The following example creates a file chooser and displays it as first an open-file dialog and then as a save-file dialog:
        String filename = File.separator+"tmp";
        JFileChooser fc = new JFileChooser(new File(filename));
        // Show open dialog; this method does not return until the dialog is closed
        fc.showOpenDialog(frame);
        File selFile = fc.getSelectedFile();
        // Show save dialog; this method does not return until the dialog is closed
        fc.showSaveDialog(frame);
        selFile = fc.getSelectedFile();Here is a more elaborate example that creates two buttons that create and show file chooser dialogs.
        // This action creates and shows a modal open-file dialog.
        public class OpenFileAction extends AbstractAction {
            JFrame frame;
            JFileChooser chooser;
            OpenFileAction(JFrame frame, JFileChooser chooser) {
                super("Open...");
                this.chooser = chooser;
                this.frame = frame;
            public void actionPerformed(ActionEvent evt) {
                // Show dialog; this method does not return until dialog is closed
                chooser.showOpenDialog(frame);
                // Get the selected file
                File file = chooser.getSelectedFile();
        // This action creates and shows a modal save-file dialog.
        public class SaveFileAction extends AbstractAction {
            JFileChooser chooser;
            JFrame frame;
            SaveFileAction(JFrame frame, JFileChooser chooser) {
                super("Save As...");
                this.chooser = chooser;
                this.frame = frame;
            public void actionPerformed(ActionEvent evt) {
                // Show dialog; this method does not return until dialog is closed
                chooser.showSaveDialog(frame);
                // Get the selected file
                File file = chooser.getSelectedFile();
        };Here's some code that demonstrates the use of the actions:
        JFrame frame = new JFrame();
        // Create a file chooser
        String filename = File.separator+"tmp";
        JFileChooser fc = new JFileChooser(new File(filename));
        // Create the actions
        Action openAction = new OpenFileAction(frame, fc);
        Action saveAction = new SaveFileAction(frame, fc);
        // Create buttons for the actions
        JButton openButton = new JButton(openAction);
        JButton saveButton = new JButton(saveAction);
        // Add the buttons to the frame and show the frame
        frame.getContentPane().add(openButton, BorderLayout.NORTH);
        frame.getContentPane().add(saveButton, BorderLayout.SOUTH);
        frame.pack();
        frame.setVisible(true);

  • Swing GUI for Javadoc

    Hi everyone,
    I'm trying to learn some basic IO and Swing. My project is to make a Swing GUI for javadoc. It's supposed to run at least under W2K and XP.
    The Swing part is going fine, but I can't seem to get IO-part working.
    I tried working with the Runtime- and the Process-class, but I don't can't seem to execute javadoc or read any command-line output. Here's a sample of code that compiles ok, but doesn't do anything.
    try {
    Process p = Runtime.getRuntime().exec("javadoc");
    InputStream in = p.getInputStream();
    String s = in.toString();
    System.out.println(s);
    System.out.println();
    System.out.println(process.waitFor());
    System.out.println();
    System.out.println(process.exitValue());
    System.out.println();
    System.out.println(""+process);
    } catch (Exception e) {
    System.out.println("error");
    if anyone has any tips, suggestions or simple code samples, I would be very happy to hear from you.

    Alright, I figured out how to read the inputstream, but
    I still get an error:
    Windows 2000
    start
    <ERROR>
    javadoc: No packages or classes specified.
    and the program doesn't terminate for some reason.
    here's the new sourcecode:
    import java.io.*;
    public class JavaDocCommander {
         public static void main(String[] args) {
              System.out.println(System.getProperty("os.name"));
              System.out.println("start");
              new Test();
              System.out.println("slut");
    class Test{
         public Test(){
              try {           
    Runtime rt = Runtime.getRuntime();
    Process proc = rt.exec("javadoc");
    InputStream stderr = proc.getErrorStream();
    InputStreamReader isr = new InputStreamReader(stderr);
    BufferedReader br = new BufferedReader(isr);
    String line = null;
    System.out.println("<ERROR>");
    while ( (line = br.readLine()) != null)
    System.out.println(line);
    System.out.println("</ERROR>");
    int exitVal = proc.waitFor();
    System.out.println("Process exitValue: " + exitVal);
    } catch (Throwable t)
    t.printStackTrace();
              

  • Recommended Tool for devloping Swing GUI's?

    Hello everyone.
    I was wondering what a good tool kit was for building swing gui's?
    I heard NetBean was one, any others you recommend?
    Currently I use Rational Software Architect to do all my java coding but I don't see any options in this IDE for creating drag and drop GUI development.
    Thanks!

    You have 2 very different answers to consider. Before making your final decision, I'd ask yourself, which of the two responders is a Swing expert and which isn't. That should put a whole lot of added weight to one of the recs. Just my two scheckel's worth.

  • JavaFx GUI builder

    older releases of netbens had a Javafx composer which allows us to develop applications easily but when i download netbeans 7.1 i can't find ant gui builder!! i search lot in google but didnt found any quire i would be a great help if anyone can give a little hand
    thanx
    Imal hasaranga perera

    Hi smith,
    I have accepted the license agreement, and trying to download Windows 32-Bit(msi). It downloads 15.9 MB of 16 MB than gives a error message saying "Cannot Copy Javafx_scenebuilder-1_0-beta-b41_windows-i586-04_jun-2012[1]: Access is denied", but it saves the installer.
    When I tried to run the scene builder installer it gives a Windows Installer error message saying "This installer package could not be opened. Contact the application vendor to verify that this is a valid windows installer package"
    I am not getting whats going wrong. Can you please help me. Please mail it to [email protected] if possible.
    Thanks a lot.

  • JAVA GUI Builder

    Hi,
    Does anyone know any "good" Java GUI Builder?
    Thank all.
    Dang Nguyen Duc

    There is a combination of tools you may find useful:
    Eclipse as an IDE - free and downloadable from eclipse.org
    Plugin for Eclipse called swt-designer. Free version for non-commercial use; very minimal price (~$200) for commercial use (one seat).
    Caveat: This is built around using SWT, not AWT/Swing.
    JBuilder also has GUI building tools.

Maybe you are looking for

  • Firefox lags too much when i download and close the current window, then try to open a new window. why?

    ok, everytime i download something the download window pops up, so i let it download and i like to keep it open so i can monitor my downloads. now, the problem is when i close the current firefox browser window and try to re-open a new one. my firefo

  • Pocket IE Issues on ApEx 3.0

    The other day I had an issue with the javascript doSubmit() function that's associated with all the buttons in ApEx not working with Pocket IE. That thread can be found here: Javascript problem in ApEx 3.0 [Solved] Another issue has surfaced over the

  • ActionScript on Flash buttons

    I am just getting back into using Captivate 2.0 to create some online training and I need some assistance using JavaScript/ActionScript in Flash buttons. I created a series of buttons that are part of a single Flash .swf file. I'm using these buttons

  • Transfer messages in nokia suite to another comput...

    Hi, would anyone please tell me if it is possible to transfer all the SMSes stored in nokia suite into another computer, via an external hard disk. if it is not possible, is there any other way to do it? thank you! Solved! Go to Solution.

  • NullPointerException in SearchDialog of af:inputListOfValues

    Hello! Working in JDEV 11.1.1.5. I have an issue while using InputListOfValues. We use two InputListOfValues, one for Postal Code and the other for Town. So, I open the Search Dialog of Postal Code and search for one, I select one and close the Searc