Alignment in a gui

Hi chaps I'm using swing and the awt to make a gui for a sensor network simulation i've made. problem is i've got two JLabels and two JTextAreas on the same line as it were, i'd like them to be centre aligned, on separate lines, one under another.
i've got a content manager but i don't understand how to do what i need to do
cheers
public GUI()
     super( "SNS : Sensor Network Simulation" );
     Container c = getContentPane();
     c.setLayout( new FlowLayout() );
     Nonsense = new JLabel("Number of active sensors remaining");
     noquery = new JLabel("Number of queries executed");
     text5 = new JTextArea(text1.getText(), 1,4);
     text5.setEditable(false);
     text6 = new JTextArea(null, 1, 4);
     text6.setEditable(false);
then i add them to the container.

This is realy primitive but maybe the one you're looking for:
public class Test extends javax.swing.JFrame {
    /** Creates new form prova */
    public Test() {
        initComponents();
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
    private void initComponents() {
        jPanel1 = new javax.swing.JPanel();
        jPanel2 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jTextField1 = new javax.swing.JTextField();
        jPanel3 = new javax.swing.JPanel();
        jPanel4 = new javax.swing.JPanel();
        jLabel11 = new javax.swing.JLabel();
        jLabel21 = new javax.swing.JLabel();
        jTextField2 = new javax.swing.JTextField();
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowClosing(java.awt.event.WindowEvent evt) {
                exitForm(evt);
        jPanel1.setLayout(new java.awt.GridLayout(3, 4));
        jPanel2.setLayout(new java.awt.GridBagLayout());
        jLabel1.setText("Lable");
        jPanel2.add(jLabel1, new java.awt.GridBagConstraints());
        jLabel2.setText("    ");
        jPanel2.add(jLabel2, new java.awt.GridBagConstraints());
        jTextField1.setText("jTextField1");
        jPanel2.add(jTextField1, new java.awt.GridBagConstraints());
        jPanel1.add(jPanel2);
        jPanel1.add(jPanel3);
        jPanel4.setLayout(new java.awt.GridBagLayout());
        jLabel11.setText("Lable");
        jPanel4.add(jLabel11, new java.awt.GridBagConstraints());
        jLabel21.setText("    ");
        jPanel4.add(jLabel21, new java.awt.GridBagConstraints());
        jTextField2.setText("jTextField2");
        jPanel4.add(jTextField2, new java.awt.GridBagConstraints());
        jPanel1.add(jPanel4);
        getContentPane().add(jPanel1, java.awt.BorderLayout.CENTER);
        pack();
    /** Exit the Application */
    private void exitForm(java.awt.event.WindowEvent evt) {
        System.exit(0);
     * @param args the command line arguments
    public static void main(String args[]) {
        new prova().show();
    // Variables declaration - do not modify
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JLabel jLabel21;
    private javax.swing.JTextField jTextField2;
    private javax.swing.JTextField jTextField1;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel1;
    // End of variables declaration
}Good luck.

Similar Messages

  • Mutlithreading with GUI

    hey guys,
    I was working on some Socket programming assignment and encountered an intersting problem.
    i am using Swing for GUI and Threads to communicate with clients.
    My server GUi has a JButton("Start Server") to trigger the Server. or we can say.. it starts accepting connection( SocketObj = ServerSocketObj.accept() )
    problem:
    as soon as i press the only Button(i.e. StartServer Button) on my Server GUI. whole GUI freezes!
    but Server is working... all updates on GUI are missing.. cant repaint components, etc. neither WindowClosing event , setDefaultCloseOperation()) is working.
    i did some research.. found that swing components are not thread safe,
    also found some close answers,, along the lines of.. Event Dispatch Thread, SwingUtilities.invokeLater(Runnable), SwingWorker class , but neither work or maybe i did not implement them properly..
    Attachment contains my code for:
    Server.java : Server class conatins main()
    ServerGUI.java : gui for server.. called from Server Class
    ClientHandler.java : Thread for handling clients.. also called from Serve class
    Cleint.java : simple client to connect to server at localhost
    Any sort of help would be highly obliged.
    thanks in advance.
    - Ravi

    Server.java
    import java.net.*;
    import java.io.*;
    public class Server {
        private ServerSocket ss;
        private Socket sc;
        public ServerSocket getSs() {
            return ss;
        public void setSs(ServerSocket ss) {
            this.ss = ss;
        public Socket getSc() {
            return sc;
        public void setSc(Socket sc) {
            this.sc = sc;
        public Server() {
            try{
            ss = new ServerSocket(4000);
            }catch(IOException e){e.printStackTrace();}
            startGUI();
        public void startGUI()
            new ServerGUI(this);
        public void getConnection()
            int i = 1;
            try {
                Socket sc = getSc();
                while (true) {
                    sc = getSs().accept();
                    Thread t = new Thread(new ClientHandler(sc,i));
                    t.start();
                    System.out.println("got client " + i);
                    i++;
            } catch (IOException e) {
                e.printStackTrace();
        public static void main(String[] args) {
            new Server();
    }ServerGUI.java
    import java.net.*;
    import java.io.*;
    public class ServerGUI extends javax.swing.JFrame {
         private javax.swing.JButton jButton1;
        Server m;
        public ServerGUI(Server m) {
            initComponents();
            this.m=m;
            setVisible(true);
            setDefaultCloseOperation(EXIT_ON_CLOSE);
        private void initComponents() {
            jButton1 = new javax.swing.JButton();
            setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
            jButton1.setText("jButton1");
            jButton1.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jButton1ActionPerformed(evt);
            javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
            getContentPane().setLayout(layout);
            layout.setHorizontalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                    .addContainerGap(178, Short.MAX_VALUE)
                    .addComponent(jButton1)
                    .addGap(147, 147, 147))
            layout.setVerticalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addGap(93, 93, 93)
                    .addComponent(jButton1)
                    .addContainerGap(184, Short.MAX_VALUE))
            pack();
        private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
            m.getConnection();
    }ClientHandler.java
    import java.net.*;
    public class ClientHandler implements Runnable {
        Socket sock;
        int n;
        public ClientHandler(Socket s, int n) {
            sock = s;
            this.n = n;
        public void run() {
            while (true) {
                System.out.println("Client Thread: " + n);
                try {
                    Thread.sleep(2000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
    }Client.java
    import java.net.*;
    import java.io.*;
    public class Client {
        Socket sc;
        public Client() {
            try{
            sc=new Socket("127.0.0.1",4000);
            System.out.println("got server");
            }catch(UnknownHostException e){e.printStackTrace();}
            catch(IOException e){e.printStackTrace();}
        public static void main(String args[])
            new Client();
    }

  • Mutlithreading with GUI problem

    hey guys,
    I was working on some Socket programming assignment and encountered an intersting problem.
    i am using Swing for GUI and Threads to communicate with clients.
    My server GUi has a JButton("Start Server") to trigger the Server. or we can say.. it starts accepting connection( SocketObj = ServerSocketObj.accept() )
    problem:
    as soon as i press the only Button(i.e. StartServer Button) on my Server GUI. whole GUI freezes!
    but Server is working... all updates on GUI are missing.. cant repaint components, etc. neither WindowClosing event , setDefaultCloseOperation()) is working.
    i did some research.. found that swing components are not thread safe,
    also found some close answers,, along the lines of.. Event Dispatch Thread, SwingUtilities.invokeLater(Runnable), SwingWorker class , but neither work or maybe i did not implement them properly..
    Attachment contains my code for:
    Server.java : Server class conatins main()
    ServerGUI.java : gui for server.. called from Server Class
    ClientHandler.java : Thread for handling clients.. also called from Serve class
    Cleint.java : simple client to connect to server at localhost
    Any sort of help would be highly obliged.
    thanks in advance.
    - Ravi

    here is the code...
    Server.java
    import java.net.*;
    import java.io.*;
    public class Server {
        private ServerSocket ss;
        private Socket sc;
        public ServerSocket getSs() {
            return ss;
        public void setSs(ServerSocket ss) {
            this.ss = ss;
        public Socket getSc() {
            return sc;
        public void setSc(Socket sc) {
            this.sc = sc;
        public Server() {
            try{
            ss = new ServerSocket(4000);
            }catch(IOException e){e.printStackTrace();}
            startGUI();
        public void startGUI()
            new ServerGUI(this);
        public void getConnection()
            int i = 1;
            try {
                Socket sc = getSc();
                while (true) {
                    sc = getSs().accept();
                    Thread t = new Thread(new ClientHandler(sc,i));
                    t.start();
                    System.out.println("got client " + i);
                    i++;
            } catch (IOException e) {
                e.printStackTrace();
        public static void main(String[] args) {
            new Server();
    }ServerGUI.java
    import java.net.*;
    import java.io.*;
    public class ServerGUI extends javax.swing.JFrame {
         private javax.swing.JButton jButton1;
        Server m;
        public ServerGUI(Server m) {
            initComponents();
            this.m=m;
            setVisible(true);
            setDefaultCloseOperation(EXIT_ON_CLOSE);
        private void initComponents() {
            jButton1 = new javax.swing.JButton();
            setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
            jButton1.setText("jButton1");
            jButton1.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jButton1ActionPerformed(evt);
            javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
            getContentPane().setLayout(layout);
            layout.setHorizontalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                    .addContainerGap(178, Short.MAX_VALUE)
                    .addComponent(jButton1)
                    .addGap(147, 147, 147))
            layout.setVerticalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addGap(93, 93, 93)
                    .addComponent(jButton1)
                    .addContainerGap(184, Short.MAX_VALUE))
            pack();
        private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
            m.getConnection();
    }ClientHandler.java
    import java.net.*;
    public class ClientHandler implements Runnable {
        Socket sock;
        int n;
        public ClientHandler(Socket s, int n) {
            sock = s;
            this.n = n;
        public void run() {
            while (true) {
                System.out.println("Client Thread: " + n);
                try {
                    Thread.sleep(2000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
    }Client.java
    import java.net.*;
    import java.io.*;
    public class Client {
        Socket sc;
        public Client() {
            try{
            sc=new Socket("127.0.0.1",4000);
            System.out.println("got server");
            }catch(UnknownHostException e){e.printStackTrace();}
            catch(IOException e){e.printStackTrace();}
        public static void main(String args[])
            new Client();
    }

  • I just statred Flash CC for the first time and it seems that the text within the pop-up window (dialog box) is mis-aligned and not allowing me access to the command buttons, nor all the text. (ie: the NEW Template Box, can't see but 2/3 of the content)

    I just statred Flash CC for the first time and it seems that the text within the pop-up window (dialog box) is mis-aligned and not allowing me access to the command buttons, nor all the text. (ie: the NEW Template Box, can't see but 2/3 of the content) is there a fix to this problem? using 8.1, Monitor is a high res.2560x1440.

    Another View.
    the GUI is so hard to read (so small) I enlarge my Ps UI by the instructions below...which helped a lot.

  • HOW TO: Create a GUI "Hello World"

     </p>
    This document describes how to create and run a very simple &quot;Hello World&quot;
    Java GUI app using JDeveloper. The application will have one button and one
    text field. Clicking the button will populate the text field with the message,
    &quot;Hello World!&quot;</p>
    Creating The New Application
    In this section, we will create an application with an empty frame.</p>
    <ol>
    [*]Choose File | New Workspace.
    </li>
    [*]Choose File | Save Workspace.
    </li>
    [*]Enter <TT>HelloGui.jws</tt> as the name for the workspace.
    This creates a Workspace called HelloGui. A workspace organizes all the projects
    you need to work on at one time.
    </li>
    [*]Choose File | New Project.
    The Project Wizard opens. This wizard will help you create a new project called
    HelloGui. A project contains all the files that go together in one &quot;tier&quot;--for
    example, all the files belonging to a single Java Application client, or all
    the files belonging to an Enterprise Java Bean. Because we are working on
    a simple, one-tier application, we will only need one project in our workspace.
    </li>
    [*]If the Welcome page appears, click Next.
    </li>
    [*]On the Project Type page, in the What is the Project's Filename?
    field, change the filename to <TT>HelloGui.jpr</tt>. Leave the rest of the
    path the same.
    </li>
    [*]Select A Project containing a new... and choose Application
    from the dropdown list.
    </li>
    [*]Click Next.
    </li>
    [*]On the Project Options page, in the What is the name of the project's
    default package field, enter <TT>helloGui</tt>.
    </li>
    [*]Click Next.
    </li>
    [*]On the Project Information page, you can enter any information about your
    project that you wish.
    </li>
    [*]Click Finish.
    The Application Wizard opens.
    </li>
    [*]In the Class field, enter <TT>HelloApp</tt>.
    </li>
    [*]Select the New Empty Frame radio button.
    </li>
    [*]Click OK.
    The Frame Wizard opens.
    </li>
    [*]In the Class field, enter <TT>HelloFrame</tt>.
    </li>
    [*]Click OK.
    JDeveloper creates an application, <TT>HelloApp</tt>, containing an empty
    frame, <TT>HelloFrame</tt>. The source code for these classes appears in the
    Navigator, which is the upper left-hand pane in the JDeveloper IDE.
    </li>
    [*]Choose File | Save All.</li>
    </ol>
    Adding a Panel to the Frame
    In this section, we will now add a panel to the frame. In the next section,
    we will add all the other components to this panel.</p>
    <ol>
    [*]In the Navigator, double-click <TT>HelloFrame.java</tt>.
    A viewer opens. This viewer has four tabs at the bottom:
    <ul>
    [*]Source, the currently active tab, which displays the source code
    of the selected class</li>
    [*]Design, which invokes a visual layout designer</li>
    [*]Class, which invokes an editor for the class' attributes, and
    can help you stay JavaBean complient</li>
    [*]Doc, which displays the class' JavaDoc
    </li>
    </ul>
    </li>
    [*]Click the Design tab.
    The viewer now displays a grey square, a graphical mock-up of your frame.
    Also, on the right-hand side of your screen, the Property Inspector opens.
    This allows you to quickly set attributes and define events for components.
    </li>
    [*]In the component palette (the tabbed toolbar near the top of your screen),
    select the Swing Containers tab.
    </li>
    [*]Click the blue square (described in rollover text as <TT>JPanel</tt>) and
    click on your frame to add the panel.
    The Property Inspector now displays attributes of the JPanel.
    </li>
    [*]In the Property Inspector, click twice inside the box beside the name
    field.
    </li>
    [*]Change the name to mainPanel.
    </li>
    [*]Click the box beside the layout field.
    </li>
    [*]Choose XYLayout.
    XYLayout is an easy-to-use Layout for prototyping. Later, we will change the
    layout to a more portable one.</li>
    </ol>
    Adding Components to the Panel
    In this section, we finish laying out a prototype UI. We will add polish and
    portability to the UI later.</p>
    <ol>
    [*]In the Component Palette, select the Swing tab.
    </li>
    [*]Select the <TT>JTextField</tt> component, which looks like a text field
    with a cursor.
    </li>
    [*]In your panel, click and drag the cursor to outline the text field.
    Don't worry if the text field doesn't have exactly the right size or position.
    We will adjust these later.
    The Property Inspector now displays attributes of the JTextField.
    </li>
    [*]In the Property Inspector, change the name (just as you did for the
    JPanel) to <TT>displayField</tt>.
    </li>
    [*]Change the text to nothing (erase the value that is already there).
    </li>
    [*]In the Component Palette, select the <TT>JButton</tt> component, which looks
    like a button being clicked.
    </li>
    [*]In your panel, click and drag the cursor to outline the button.
    The Property Inspector now displays attributes of the JButton.
    </li>
    [*]In the Property Inspector, change the name and action command
    to helloButton.
    </li>
    [*]Change the text to <TT>Say Hello!</tt>.
    </li>
    [*]Choose File | Save All.</li>
    </ol>
    Wiring Up the UI
    In this section, we wire the UI so that clicking the button causes &quot;Hello
    World!&quot; to display in the text field.</p>
    <ol>
    [*]In the Property Inspector, select the Events tab.
    </li>
    [*]Click the box next to the Action Performed field and press the Enter
    key.
    This creates a method, <TT>helloButton_actionPerformed()</tt>, which will
    be invoked when the button is clicked, and displays the source code for the
    method stub in the viewer.
    </li>
    [*]In the viewer, add the following command to the body of the method:
    <TT>displayField.setText(&quot;Hello World!&quot;);</tt>
    </li>
    [*]Choose File | Save All.</li>
    </ol>
    Testing the Prototype Application
    <ol>
    [*]Choose Run | Run &quot;HelloApp&quot;.
    Your application appears, with a blank text field and a button labeled &quot;Say
    Hello!&quot;
    </li>
    [*]Click the button.
    The text &quot;Hello World!&quot; appears in the text field.
    </li>
    [*]Close your application.</li>
    </ol>
    Refining the UI
    In this section, we polish the UI so that the components have the right size
    and alignment, the text in the text field shows up red, and the panel uses the
    portable GridBag layout instead of the JDeveloper-specific XYLayout.</p>
    <ol>
    [*]In the viewer, select the Design tab.
    </li>
    [*]Select your text field.
    </li>
    [*]Drag the edges of your text field until it is the size you want.
    </li>
    [*]Drag the center of the text field until it is the vertical position you
    want.
    </li>
    [*]Right-click the text field and choose Align Center.
    This centers your text field horizontally in the frame.
    </li>
    [*]In the property inspector, click the box next to the foreground field.
    </li>
    [*]Click the ellipses (...).
    A color editor appears.
    </li>
    [*]Select Red from the dropdown list.
    </li>
    [*]Click OK.
    </li>
    [*]On your frame, select your button.
    </li>
    [*]Drag the right edge of your button until it is the horizontal size you want.
    </li>
    [*]Select your text field, and multi-select your button by control-clicking
    it.
    </li>
    [*]Right-click your button or text field.
    </li>
    [*]Choose Same Size Vertical.
    This sets the height of all selected components to that of the first selected
    component (the text field).
    </li>
    [*]Right-click your button or text field.
    </li>
    [*]Choose Align Center.
    This aligns the center of all selected components to that of the first selected
    component (the text field).
    </li>
    [*]Select your panel by clicking anywhere on the grey background in the visual
    designer.
    </li>
    [*]In the Property Inspector, click the box beside the layout field.
    </li>
    [*]Select GridBagLayout from the dropdown list.
    </li>
    [*]Choose File | Save All.</li>
    </ol>
    Running the Finished Application From Within JDeveloper
    <ol>
    [*]Choose Run | Run &quot;HelloApp&quot;.
    Your application appears, with a blank text field and a button labeled &quot;Say
    Hello!&quot;
    </li>
    [*]Click the button.
    The text &quot;Hello World!&quot; appears in the text field, in red.
    </li>
    [*]Close your application.</li>
    </ol>
    Deploying the Application to Your File System
    <ol>
    [*] In the Navigator, right-click <tt>HelloGui.jpr</tt> and choose New Deployment
    Profile.
    The Deployment Profile Wizard opens.
    </li>
    [*]If the Welcome page appears, click Next.
    </li>
    [*]On the Delivery page, select Web Application or Command-Line Application
    from the dropdown list, and click Next.
    </li>
    [*]On the Staging Area page, in the Deployment Destination field, enter
    <tt><JDeveloper>/HelloGui</tt>, where <tt><JDeveloper></tt>
    is your JDeveloper root directory. Click Next.
    </li>
    [*]On the Project page, select all the <tt>.java</tt> files and click Next.
    </li>
    [*]Skip the Archive page and Applet Tags page by clicking Next on each.
    </li>
    [*]On the Libraries page, shuttle all libraries from the Project Libraries
    list to the Deployed Libraries list, and click Next.
    </li>
    [*]On the Finish page, name the profile <tt>HelloGui.prf</tt>, and click Finish.
    </li>
    [*]When JDeveloper asks you if you want to deploy now, click Yes.</li>
    </ol>
    JDeveloper will archive your application files and copy this archive and all
    other required libraries to <tt><JDeveloper>/HelloGui</tt>.</p>
    Running the Application from the Command Line
    <ol>
    [*]Open a command-line prompt.
    </li>
    [*]Enter the following script.
    Note: You may want to create a batch file containing this script. Be
    sure to replace JDeveloper_Home with your JDeveloper home directory.
    <pre>set __CLASSPATH_ROOT_DIR__=JDeveloper_Home\HelloGui
    set CLASSPATH=&quot;%__CLASSPATH_ROOT_DIR__%\HelloGui.jar&quot;
    set CLASSPATH=%CLASSPATH%;&quot;%__CLASSPATH_ROOT_DIR__%\xmlparserv2.jar&quot;
    set CLASSPATH=%CLASSPATH%;&quot;%__CLASSPATH_ROOT_DIR__%\classes12.zip&quot;
    set CLASSPATH=%CLASSPATH%;&quot;%__CLASSPATH_ROOT_DIR__%\jdev-rt.zip&quot;
    set CLASSPATH=%CLASSPATH%;&quot;%__CLASSPATH_ROOT_DIR__%\swingall.jar&quot;
    cd JDeveloper_Home\HelloGui
    jre -cp %CLASSPATH% helloGui.HelloApp</pre>
    </li>
    [*]Your application appears, with a blank text field and a button labeled &quot;Say
    Hello!&quot;
    </li>
    [*]Click the button.
    The text &quot;Hello World!&quot; appears in the text field, in red.
    </li>
    [*]Close your application.</li>
    </ol>
    </p>
     </p>
    null

    Hello,
    I followed your instruction step by step to make this "Hello World", but when I run it, I got message "cannot find the runable node". What do I miss here? Thanks.
    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Avrom Faderman ([email protected]):
    </p>
    This document describes how to create and run a very simple "Hello World"
    Java GUI app using JDeveloper. The application will have one button and one
    text field. Clicking the button will populate the text field with the message,
    "Hello World!"</p>
    [b]Creating The New Application
    In this section, we will create an application with an empty frame.</p>
    <ol>
    [*]Choose File | New Workspace.
    </li>
    [*]Choose File | Save Workspace.
    </li>
    [*]Enter <TT>HelloGui.jws</tt> as the name for the workspace.
    This creates a Workspace called HelloGui. A workspace organizes all the projects
    you need to work on at one time.
    </li>
    [*]Choose File | New Project.
    The Project Wizard opens. This wizard will help you create a new project called
    HelloGui. A project contains all the files that go together in one "tier"--for
    example, all the files belonging to a single Java Application client, or all
    the files belonging to an Enterprise Java Bean. Because we are working on
    a simple, one-tier application, we will only need one project in our workspace.
    </li>
    [*]If the Welcome page appears, click Next.
    </li>
    [*]On the Project Type page, in the What is the Project's Filename?
    field, change the filename to <TT>HelloGui.jpr</tt>. Leave the rest of the
    path the same.
    </li>
    [*]Select A Project containing a new... and choose Application
    from the dropdown list.
    </li>
    [*]Click Next.
    </li>
    [*]On the Project Options page, in the What is the name of the project's
    default package field, enter <TT>helloGui</tt>.
    </li>
    [*]Click Next.
    </li>
    [*]On the Project Information page, you can enter any information about your
    project that you wish.
    </li>
    [*]Click Finish.
    The Application Wizard opens.
    </li>
    [*]In the Class field, enter <TT>HelloApp</tt>.
    </li>
    [*]Select the New Empty Frame radio button.
    </li>
    [*]Click OK.
    The Frame Wizard opens.
    </li>
    [*]In the Class field, enter <TT>HelloFrame</tt>.
    </li>
    [*]Click OK.
    JDeveloper creates an application, <TT>HelloApp</tt>, containing an empty
    frame, <TT>HelloFrame</tt>. The source code for these classes appears in the
    Navigator, which is the upper left-hand pane in the JDeveloper IDE.
    </li>
    [*]Choose File | Save All.</li>
    </ol>
    Adding a Panel to the Frame
    In this section, we will now add a panel to the frame. In the next section,
    we will add all the other components to this panel.</p>
    <ol>
    [*]In the Navigator, double-click <TT>HelloFrame.java</tt>.
    A viewer opens. This viewer has four tabs at the bottom:
    <ul>
    [*]Source, the currently active tab, which displays the source code
    of the selected class</li>
    [*]Design, which invokes a visual layout designer</li>
    [*]Class, which invokes an editor for the class' attributes, and
    can help you stay JavaBean complient</li>
    [*]Doc, which displays the class' JavaDoc
    </li>
    </ul>
    </li>
    [*]Click the Design tab.
    The viewer now displays a grey square, a graphical mock-up of your frame.
    Also, on the right-hand side of your screen, the Property Inspector opens.
    This allows you to quickly set attributes and define events for components.
    </li>
    [*]In the component palette (the tabbed toolbar near the top of your screen),
    select the Swing Containers tab.
    </li>
    [*]Click the blue square (described in rollover text as <TT>JPanel</tt>) and
    click on your frame to add the panel.
    The Property Inspector now displays attributes of the JPanel.
    </li>
    [*]In the Property Inspector, click twice inside the box beside the name
    field.
    </li>
    [*]Change the name to mainPanel.
    </li>
    [*]Click the box beside the layout field.
    </li>
    [*]Choose XYLayout.
    XYLayout is an easy-to-use Layout for prototyping. Later, we will change the
    layout to a more portable one.</li>
    </ol>
    Adding Components to the Panel
    In this section, we finish laying out a prototype UI. We will add polish and
    portability to the UI later.</p>
    <ol>
    [*]In the Component Palette, select the Swing tab.
    </li>
    [*]Select the <TT>JTextField</tt> component, which looks like a text field
    with a cursor.
    </li>
    [*]In your panel, click and drag the cursor to outline the text field.
    Don't worry if the text field doesn't have exactly the right size or position.
    We will adjust these later.
    The Property Inspector now displays attributes of the JTextField.
    </li>
    [*]In the Property Inspector, change the name (just as you did for the
    JPanel) to <TT>displayField</tt>.
    </li>
    [*]Change the text to nothing (erase the value that is already there).
    </li>
    [*]In the Component Palette, select the <TT>JButton</tt> component, which looks
    like a button being clicked.
    </li>
    [*]In your panel, click and drag the cursor to outline the button.
    The Property Inspector now displays attributes of the JButton.
    </li>
    [*]In the Property Inspector, change the name and action command
    to helloButton.
    </li>
    [*]Change the text to <TT>Say Hello!</tt>.
    </li>
    [*]Choose File | Save All.</li>
    </ol>
    Wiring Up the UI
    In this section, we wire the UI so that clicking the button causes "Hello
    World!" to display in the text field.</p>
    <ol>
    [*]In the Property Inspector, select the Events tab.
    </li>
    [*]Click the box next to the Action Performed field and press the Enter
    key.
    This creates a method, <TT>helloButton_actionPerformed()</tt>, which will
    be invoked when the button is clicked, and displays the source code for the
    method stub in the viewer.
    </li>
    [*]In the viewer, add the following command to the body of the method:
    <TT>displayField.setText("Hello World!");</tt>
    </li>
    [*]Choose File | Save All.</li>
    </ol>
    Testing the Prototype Application
    <ol>
    [*]Choose Run | Run "HelloApp".
    Your application appears, with a blank text field and a button labeled "Say
    Hello!"
    </li>
    [*]Click the button.
    The text "Hello World!" appears in the text field.
    </li>
    [*]Close your application.</li>
    </ol>
    Refining the UI
    In this section, we polish the UI so that the components have the right size
    and alignment, the text in the text field shows up red, and the panel uses the
    portable GridBag layout instead of the JDeveloper-specific XYLayout.</p>
    <ol>
    [*]In the viewer, select the Design tab.
    </li>
    [*]Select your text field.
    </li>
    [*]Drag the edges of your text field until it is the size you want.
    </li>
    [*]Drag the center of the text field until it is the vertical position you
    want.
    </li>
    [*]Right-click the text field and choose Align Center.
    This centers your text field horizontally in the frame.
    </li>
    [*]In the property inspector, click the box next to the foreground field.
    </li>
    [*]Click the ellipses (...).
    A color editor appears.
    </li>
    [*]Select Red from the dropdown list.
    </li>
    [*]Click OK.
    </li>
    [*]On your frame, select your button.
    </li>
    [*]Drag the right edge of your button until it is the horizontal size you want.
    </li>
    [*]Select your text field, and multi-select your button by control-clicking
    it.
    </li>
    [*]Right-click your button or text field.
    </li>
    [*]Choose Same Size Vertical.
    This sets the height of all selected components to that of the first selected
    component (the text field).
    </li>
    [*]Right-click your button or text field.
    </li>
    [*]Choose Align Center.
    This aligns the center of all selected components to that of the first selected
    component (the text field).
    </li>
    [*]Select your panel by clicking anywhere on the grey background in the visual
    designer.
    </li>
    [*]In the Property Inspector, click the box beside the layout field.
    </li>
    [*]Select GridBagLayout from the dropdown list.
    </li>
    [*]Choose File | Save All.</li>
    </ol>
    Running the Finished Application From Within JDeveloper
    <ol>
    [*]Choose Run | Run "HelloApp".
    Your application appears, with a blank text field and a button labeled "Say
    Hello!"
    </li>
    [*]Click the button.
    The text "Hello World!" appears in the text field, in red.
    </li>
    [*]Close your application.</li>
    </ol>
    Deploying the Application to Your File System
    <ol>
    [*] In the Navigator, right-click <tt>HelloGui.jpr</tt> and choose New Deployment
    Profile.
    The Deployment Profile Wizard opens.
    </li>
    [*]If the Welcome page appears, click Next.
    </li>
    [*]On the Delivery page, select Web Application or Command-Line Application
    from the dropdown list, and click Next.
    </li>
    [*]On the Staging Area page, in the Deployment Destination field, enter
    <tt><JDeveloper>/HelloGui</tt>, where <tt><JDeveloper></tt>
    is your JDeveloper root directory. Click Next.
    </li>
    [*]On the Project page, select all the <tt>.java</tt> files and click Next.
    </li>
    [*]Skip the Archive page and Applet Tags page by clicking Next on each.
    </li>
    [*]On the Libraries page, shuttle all libraries from the Project Libraries
    list to the Deployed Libraries list, and click Next.
    </li>
    [*]On the Finish page, name the profile <tt>HelloGui.prf</tt>, and click Finish.
    </li>
    [*]When JDeveloper asks you if you want to deploy now, click Yes.</li>
    </ol>
    JDeveloper will archive your application files and copy this archive and all
    other required libraries to <tt><JDeveloper>/HelloGui</tt>.</p>
    Running the Application from the Command Line
    <ol>
    [*]Open a command-line prompt.
    </li>
    [*]Enter the following script.
    Note: You may want to create a batch file containing this script. Be
    sure to replace JDeveloper_Home with your JDeveloper home directory.
    <pre>set __CLASSPATH_ROOT_DIR__=JDeveloper_Home\HelloGui
    set CLASSPATH="%__CLASSPATH_ROOT_DIR__%\HelloGui.jar"
    set CLASSPATH=%CLASSPATH%;"%__CLASSPATH_ROOT_DIR__%\xmlparserv2.jar"
    set CLASSPATH=%CLASSPATH%;"%__CLASSPATH_ROOT_DIR__%\classes12.zip"
    set CLASSPATH=%CLASSPATH%;"%__CLASSPATH_ROOT_DIR__%\jdev-rt.zip"
    set CLASSPATH=%CLASSPATH%;"%__CLASSPATH_ROOT_DIR__%\swingall.jar"
    cd JDeveloper_Home\HelloGui
    jre -cp %CLASSPATH% helloGui.HelloApp</pre>
    </li>
    [*]Your application appears, with a blank text field and a button labeled "Say
    Hello!"
    </li>
    [*]Click the button.
    The text "Hello World!" appears in the text field, in red.
    </li>
    [*]Close your application.</li>
    </ol>
    </p>
    </p><HR></BLOCKQUOTE>
    null

  • How do I convert my GUI java app to be an applet or display it on a webpage

    I have created a loan calculator program in netbeans, I got the application to run fine but now I want to add it into a html page.
    I'm just looking for a place to start, I just don't know where to go from here, I want to know if I can actually convert my app with a few changes to an applet or if any one can point me to a forum of similar interest or tutorials that explain what I'm looking for.
    I don't even know what i'm looking for except i want this program to run on a webpage.
    Or is there a way to run my .jar file on a webpage??
    My teacher has not taught us anything on this matter except the below code suggestions on converting and my program is more extensive than her examples for converting. This is what she briefly described on this subject.
    1.To convert an application to an applet the main differences are: import java.awt.Graphics; import javax.swing.JApplet; import javax.swing.JOptionPane;
         Extend JApplet Replace main with public void init() method
    Output with public void paint( Graphics g ) method
    2. Remove calls to setSize, setTitle, pack, and any window listener calls, e.g., setDefaultCloseOperation. Compile the program---if something doesn't compile just comment it out for now.
    3. Create a simple web page with the following body.
    <applet CODE="__________.class" WIDTH="300" HEIGHT="300"
    archive="http://www.cs.duke.edu/courses/fall01/cps108/resources/joggle.jar">
    Your browser does not support applets </applet>
    I understand those steps for a simple program like hello world but not my current app
    Heres my code on the 2 extend off my first GUI of the Loan Application
    public class AnalysisGUI extends GUI {
        /** Creates new form AnalysisGUI */
        public AnalysisGUI(java.awt.Frame parent, boolean modal) {
            super(parent, modal);
            initComponents();
        }//end constructor
        private DecimalFormat currency = new DecimalFormat("0.00");
        /** This method is called from within the constructor to
         * initialize the form.
         * WARNING: Do NOT modify this code. The content of this method is
         * always regenerated by the Form Editor.
        // <editor-fold defaultstate="collapsed" desc="Generated Code">
        private void initComponents() {
            analysisjButton = new javax.swing.JButton();
            jScrollPane1 = new javax.swing.JScrollPane();
            writejTextArea = new javax.swing.JTextArea();
            clearTextAreajButton = new javax.swing.JButton();
            setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
            analysisjButton.setText("Analysis");
            analysisjButton.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    analysisjButtonActionPerformed(evt);
            writejTextArea.setColumns(20);
            writejTextArea.setRows(5);
            jScrollPane1.setViewportView(writejTextArea);
            clearTextAreajButton.setText("Clear Analysis Output");
            clearTextAreajButton.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    clearTextAreajButtonActionPerformed(evt);
            javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
            getContentPane().setLayout(layout);
            layout.setHorizontalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addContainerGap()
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(analysisjButton)
                        .addComponent(clearTextAreajButton))
                    .addGap(18, 18, 18)
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 433, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(86, 86, 86))
            layout.setVerticalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addContainerGap(306, Short.MAX_VALUE)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                            .addComponent(analysisjButton)
                            .addGap(84, 84, 84)
                            .addComponent(clearTextAreajButton)
                            .addGap(113, 113, 113))
                        .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                            .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 263, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(22, 22, 22))))
            java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
            setBounds((screenSize.width-700)/2, (screenSize.height-627)/2, 700, 627);
        }// </editor-fold>
        private void analysisjButtonActionPerformed(java.awt.event.ActionEvent evt) {                                               
            // TODO add your handling code here:   
            //importing values for FOR loop of 13 pyaments a years
            ir13 = super.rate;
            balance13 = super.balance;
            time13 = super.time;
            payment13 = MortgageCalculator.CalculatePayment(ir13, balance13, time13, PayperYear13);           
            interest13 = round((balance13 * (ir13/PayperYear13)));                   
            principle13 = round(payment13 - interest13);
            //set up for 12 pyaments a year
            balance = super.balance;          
            ir = super.rate;
            time = super.time;         
            payment = super.payment;
            interest = round((balance * (ir/PayperYear12)));
            principle = round(payment - interest);
            //set up for 24 payments a year   
            balance24 = super.balance;          
            ir24 = super.rate;
            time24 = super.time;         
            payment24 = super.payment/2;
            interest24 = round((balance24 * (ir/PayperYear24)));
            principle24 = round(payment24 - interest24);
            //set up for 26 payemnts a years
            ir26 = super.rate;
            balance26 = super.balance;
            time26 = super.time;
            payment26 = MortgageCalculator.CalculatePayment(ir26, balance26, time26, PayperYear26);           
            interest26 = round((balance26 * (ir26/PayperYear26)));                   
            principle26 = round(payment26 - interest26);
         double totalPrinciple = 0;              //set to zero
         double totalInterest = 0;          //set to zero       
         for( int n = 0; n < time; n++)     //check Year of Loan
                totalPrinciple = 0;          //reset to zero for totaling Year n totals
                totalInterest = 0;          //reset to zero for totaling Year n totals
                writejTextArea.append("-----Based on 12 Payments Per Year-----\n");
                writejTextArea.append("          "+"          "+"Principle" + "    " +
                    "Interest"+ "    "+
                    "Balance"+"\n");            
                //loops through the monthly payments
                for(int i = 1; i <= PayperYear12; i++ )
                //Calculate applied amounts for chart to be printed
                interest = round((balance * ir)/PayperYear12);
                principle = round(payment - interest);
                balance = round(balance - principle);
                //total year end amounts
                totalPrinciple = totalPrinciple + principle;
                totalInterest = totalInterest + interest;
                writejTextArea.append("Payment " + i + " $" + currency.format(principle) + "     " +
                    currency.format(interest) + "      $" +
                    currency.format(balance)+"\n");     
                }//end for 12 payments per year
                //print 12 payments Totals          
                int yr = n + 1;
                writejTextArea.append("\n---Year " + yr + " Totals Based on 12 Payments Per Year---");
                writejTextArea.append("\nYear Total Principle: $" + currency.format(totalPrinciple));
                writejTextArea.append("\nYear Total Interest: $" + currency.format(totalInterest));
                writejTextArea.append("\nRemaining Balance: $" + currency.format(balance)+"\n");
                writejTextArea.append("\n-------------------------------------------------------\n");     
                //Start 13 PAYMENTS A YEAR TABLE
                double totalPrinciple13 = 0;          //reset to zero for totaling Year n totals
                double totalInterest13 = 0;          //reset to zero for totaling Year n totals
                writejTextArea.append("-----Based on 13 Payments Per Year-----\n");   
                writejTextArea.append("          "+"          "+"Principle" + "    " +
                    "Interest"+ "    "+
                    "Balance"+"\n");            
                //loops through the monthly 13 payments           
                for(int j = 1; j <= PayperYear13; j++ )
                //Calculate applied amounts for chart to be printed
                interest13 = round((balance13 * ir13)/PayperYear13);
                principle13 = round(payment13 - interest13);
                balance13 = round(balance13 - principle13);
                //total year end amounts
                totalPrinciple13 = totalPrinciple13 + principle13;
                totalInterest13 = totalInterest13 + interest13;
                //System.out.printf("\n%-10s %-10s %-10s %-10s %-10s", n + 1 , i + 1,Principle, Interest, Balance);
                //System.out.printf("\n%-10s %-10s %-10.2f %-10.2f %-10.2f", n + 1 , i + 1,round(principle), round(interest), balance);
                writejTextArea.append("Payment " + j + " $" + currency.format(principle13) + "     " +
                    currency.format(interest13) + "      $" +
                    currency.format(balance13)+"\n");         
                }//end for 13 payments per year
                //Print totals for 13 payments a year          
                yr = n + 1;
                writejTextArea.append("\n---Year " + yr + " Totals Based on 13 Payments Per Year---");
                writejTextArea.append("\nYear Total Principle: $" + currency.format(totalPrinciple13));
                writejTextArea.append("\nYear Total Interest: $" + currency.format(totalInterest13));
                writejTextArea.append("\nRemaining Balance: $" + currency.format(balance13)+"\n");
                writejTextArea.append("\n-------------------------------------------------------\n");             
                //Start 24 PAYMENTS A YEAR TABLE
                double totalPrinciple24 = 0;          //reset to zero for totaling Year n totals
                double totalInterest24 = 0;          //reset to zero for totaling Year n totals
                writejTextArea.append("-----Based on 24 Payments Per Year-----\n");
                writejTextArea.append("          "+"          "+"Principle" + "    " +
                    "Interest"+ "    "+
                    "Balance"+"\n");            
                //loops through the monthly payments
                for(int i = 1; i <= PayperYear24; i++ )
                //Calculate applied amounts for chart to be printed
                interest24 = round((balance24 * ir24)/PayperYear24);
                principle24 = round(payment24 - interest24);
                balance24 = round(balance24 - principle24);
                //total year end amounts
                totalPrinciple = totalPrinciple + principle24;
                totalInterest = totalInterest + interest24;
                writejTextArea.append("Payment " + i + " $" + currency.format(principle24) + "     " +
                    currency.format(interest24) + "      $" +
                    currency.format(balance24)+"\n"); 
                }//end for 24 payments per year
                //print 24 payments Totals
                yr = n +1;
                writejTextArea.append("\n---Year " + yr + " Totals Based on 24 Payments Per Year---");
                writejTextArea.append("\nYear Total Principle: $" + currency.format(totalPrinciple24));
                writejTextArea.append("\nYear Total Interest: $" + currency.format(totalInterest24));
                writejTextArea.append("\nRemaining Balance: $" + currency.format(balance24)+"\n");
                writejTextArea.append("\n-------------------------------------------------------\n");                        
                //Start 26 PAYMENTS A YEAR TABLE
                double totalPrinciple26 = 0;//reset to zero for totaling Year n totals
                double totalInterest26 = 0;     //reset to zero for totaling Year n totals
                writejTextArea.append("------Based on 26 Payments Per Year-----\n");
                writejTextArea.append("          "+"          "+"Principle" + "    " +
                    "Interest"+ "    "+
                    "Balance"+"\n");            
                //loops through the monthly payments 26 times
                for(int i = 1; i <= PayperYear26; i++ )
                //Calculate applied amounts for chart to be printed
                interest26 = round((balance26 * ir24)/PayperYear26);
                principle26 = round(payment26 - interest26);
                balance26 = round(balance26 - principle26);
                totalPrinciple = totalPrinciple + principle26;
                totalInterest = totalInterest + interest26;
                writejTextArea.append("Payment " + i + "  $" + currency.format(principle26) + "     " +
                    currency.format(interest26) + "      $" +
                    currency.format(balance26)+"\n");
                }//end for 26 payments per year           
                yr = n + 1;
                //prints 26 payments yearly totals
                writejTextArea.append("\n---Year " + yr + " Totals Based on 26 Payments Per Year---");
                writejTextArea.append("\nYear Total Principle: $" + currency.format(totalPrinciple26));
                writejTextArea.append("\nYear Total Interest: $" + currency.format(totalInterest26));
                writejTextArea.append("\nRemaining Balance: $" + currency.format(balance26)+"\n");
                writejTextArea.append("\n-------------------------------------------------------\n");                
            }//end for years of the loan
        private void clearTextAreajButtonActionPerformed(java.awt.event.ActionEvent evt) {
            // TODO add your handling code here:
            //clear analysis field
            writejTextArea.setText("");
        public static double round(double r)//round to cents method
              return Math.ceil(r*100)/100;
         }//end round  
        /**HI micha what a long progam
         * @param args the command line arguments
        public static void main(String args[]) {
            java.awt.EventQueue.invokeLater(new Runnable() {
                public void run() {
                    AnalysisGUI dialog = new AnalysisGUI(new javax.swing.JFrame(), true);
                    dialog.addWindowListener(new java.awt.event.WindowAdapter() {
                        public void windowClosing(java.awt.event.WindowEvent e) {
                            System.exit(0);
                    dialog.setVisible(true);
            });//end announymous
        }//end main mehtod
        //12 year declared varialbes
        //private double balance;   
        private double principle;
        private double ir;
        private double interest;
        private double PayperYear12 = 12;
        //Variables for 13 payments a years
        private int PayperYear13 = 13;
        private double balance13;
        private double principle13;
        private double ir13;
        private double interest13;
        private double payment13;
        private double time13;
        //Varialbes for 24 payments a year
        private int PayperYear24 = 24;
        private double balance24;
        private double principle24;
        private double ir24;
        private double interest24;
        private double payment24;
        private double time24;
        //Varialbes for 24 payments a year
        private int PayperYear26 = 26;
        private double balance26;
        private double principle26;
        private double ir26;
        private double interest26;
        private double payment26;
        private double time26;
        // Variables declaration - do not modify
        private javax.swing.JButton analysisjButton;
        private javax.swing.JButton clearTextAreajButton;
        private javax.swing.JScrollPane jScrollPane1;
        private javax.swing.JTextArea writejTextArea;

    Your original program extends "GUI" which appears to extend JFrame (correct me if I'm wrong). If so, the first thing you should do would be to re-write this so that it extends JPanel which shouldn't be that hard to do (at least it's not hard to do if you know a little Swing -- but I worry about someone coming into this from the netbeans-generated code world). Purists will tell you to not even extend this, to have your main GUI class hold an instance of JPanel instead, and this would work fine too, as long as one way or another, the main GUI program can produce your application displayed on a JPanel on demand.
    If you've done this correctly, then using your JPanel in a JFrame is trivial: in a main method create a JFrame, and then simply add your JPanel to the JFrame's contentPane and display it. Likewise using your JPanel in a JApplet is just as trivial as you'd do essentially the same thing: add your JPanel to the JApplet's contentPane, but this time do it in the JApplet's init method.

  • How do I query ink level in Epson CX3650 with printer-gui

    Hi,
    When using the printer gui in KDE to query the ink level on my Epson Stylus CX3650 I get the following error message
    Cannot open /Stylus CX3600 read/write: No such file or directory
    But when I use the command line tool I get
    [rene@archer mtink]$ escputil -i -r /dev/usb/lp0
    Escputil version 5.0.1, Copyright (C) 2000-2006 Robert Krawitz
    Escputil comes with ABSOLUTELY NO WARRANTY; for details type 'escputil -l'
    This is free software, and you are welcome to redistribute it
    under certain conditions; type 'escputil -l' for details.
    Ink color Percent remaining
    Cyan 22
    Magenta 26
    Yellow 27
    Photo Black 55
    Has anyone noticed the same problem, and perhaps know why the gui doesn't work?
    My user is in the following groups
    [rene@archer mtink]$ groups rene
    lp wheel video audio optical floppy storage users
    The commands "Clean print head" and "Print nozzle test pattern" work fine in the gui.
    The commands "Align print head" and "Printer identification" gives the error
    Error
    Please specify a raw device
    I have in other distros succesfuly used mtink to query the ink level, but when I tried building it from aur, I get a dependency problem with gimp-tool. I'll post a seperate post about that in the aur section later. (I'd rather get the kde printer gui to work first ).

    With pleasure!
    Great to know it worked for you
    Say thanks by clicking the Kudos thumb up in the post.
    If my post resolve your problem please mark it as an Accepted Solution

  • Specify the GUI declaratively in ActionScript like in JavaFX Script instead of MXML

    After reading a bit about JavaFX Script (which is actually remarkebly close to ActionScript 3) as a developer I thought the way one can specify the GUI declaratively in JavaFX Script via JSON-like notation for the components is pretty cool. It would be nice to have something like that in Flex/ActionScript too. The advantages I see over MXML are:
    1) a more compact notation than XML which is nice from a developers view point who actually writes this kind of code. Of course the idea would be that designers still design the GUI with graphical tools that generate this code but if you have to dive in and edit the code it's nice not to have to deal with verbose XML and I think even designers can easily understand JSON-like code; don't just assume that designers love XML because HTML was based on SGML! I'm not so sure if today many designers really still know raw HTML that well (like in 1997, the early days...). Server side developers probably know it better because they have to adapt it to jsp or asp or whatever framework.
    2) The fact that it's all ActionScript gives a seamless integration between just composing the components to form the GUI and adding scripts to add additionial behavior instead of mixing XML with actionscript code => no more need for those nasty CDATA blocks! It would also be easy for development tools like Flexbuilder to give a seamsless experience with code completion and zooming in on the code because it's all Actionscript! There's also no need for a separate expression language to tie the MXML to the underlying Actionscript. It would it also make easier to create custom components (not just simple composition components which is really easy in MXML) because you don't have to implement separate XML tags.
    here's a short JavaFX Script example:
    Frame {
    content: GroupPanel {
    var myRow = Row { alignment: BASELINE }
    var label_col = Column { alignment: TRAILING }
    var field_col = Column { alignment: LEADING }
    rows: [myRow]
    columns: [label_col, field_col]
    content:
    [SimpleLabel {
    row: myRow
    column: label_col
    text: "Type your text here:"
    TextField {
    row: myRow
    column: field_col
    columns: 50
    visible: true
    Note that this shouldn't be confused with programmatically specifying the GUI in Actionscript (which is possible today as an alternative to MXML). What I propose is at a (slightly) higher level: you don't give a detailed sequence of methods/functions to call to construct the GUI (i.e. HOW to do it) but just specify WHAT you want.
    Hopefully some Adobe Flex will see this and think about it. Although I think MXML is not too bad and I can live with it if I have to ;)

    I like that idea Sean. A standard and well-supported way to separate MXML and code would be good. I'd love to have builder support a MVC style triad for MXML files, with the
    model.as being simply an all-public-all-bindable class full of VOs and view-specific information, any view-manipulation and view<->app communications in the
    controller.as, and nothing but bindings and layour in the MXML. There's (almost) nothing stopping you doing this by hand at the moment, but it's a pain, and developers wouldn't stick to it for very long, when they need to create and maintain 3 separate files for that simple "error dialog" without a hand from Builder.
    Then again, I'd rather Adobe spent the time that would take on opening and better-documenting builder's APIs, so we can write our own plugins easily, but that's my greedy side- A standard builder-supported MVC pattern for custom MXML components would be aweseome for people that aren't me :)
    -Josh
    As for JavaFX, I don't care for it.
    On Tue, Sep 30, 2008 at 7:56 AM, Sean Christmann
    <
    [email protected]> wrote:
    A new message was posted by Sean Christmann in
    Developers --
      specify the GUI declaratively in ActionScript like in JavaFX Script instead of MXML
    Jason you bring up a good point on a concept that I think Adobe should
    poach from a different framework, Silverlight. In Silverlight the
    code-behind pattern is automatic and very nice to work with. Every
    interface can be composed of both a layout file and a script file, and
    they get composited into the SAME class at compile time. So you can
    have both a FileDialog.mxml and FileDialog.as file that know about each
    other automatically, without the need to subclass one from the other.
    Sean
    Jason Stafford wrote:
    A new message was posted by Jason Stafford in
    Developers --
      specify the GUI declaratively in ActionScript like in JavaFX Script instead of MXML
    Personally, I like the separation between the MXML and ActionScript.
    We're working on a large project, and so we have all the ActionScript
    separate from the MXML files.  For example we'll have something like
    filedialoglayout.mxml, and then
    filedialog.as that is a subclass of
    filedialoglayout.  All event handlers and the like are setup in the
    filedialog.as file - the mxml file doesn't know about any function names.
    Advantages:
    MXML files become layout only - and are more easily shared and worked on
    with non-technical people
    ActionScript is all in *.as files: no CDATA blocks and no FlexBuilder
    quirks where editing ActionScript inside a CDATA block doesn't work
    quite like in a real AS file.
    For simple experiments, and for learning, it's obviously nice to have
    everything in one mxml file, but in a big project like ours, the
    separation helps keep things clearer and more maintainable.
    Why use the mxml at all?  The MXML files are nice to edit with the
    visual editor in Flex Builder, and it's much easier to apply styles and
    embed assets in MXML than it is in pure ActionScript.
    I think two ways to talk about the same thing (XML and ActionScript) is
    already almost one too many - adding a third (JSON) would really be too
    much.
    Just my thoughts.
    -Jason Stafford
    Sean Christmann wrote:
    A new message was posted by Sean Christmann in
    Developers --
    specify the GUI declaratively in ActionScript like in JavaFX Script
    instead of MXML
    This reminds me of a certain workflow pattern that has emerged for us
    which might help provide some insight on this topic. I'm working on a
    project with a couple other developers which connects to a webservice
    for supplying clientside data. This data is available in both json
    notation and xml notation. The thing is, while the developers have
    overwhelmingly agreed that we should be consuming the json version
    since it can be parsed faster and provide more meaningful context for
    objects (ie strings vs ints vs arrays etc...), all these same
    developers rely exclusively on the xml notation when asking questions
    about the data or passing structures around to discuss.
    I see the same thing when looking at JavaFX and MXML. JavaFX might
    allow for more accurate structures and might be able to be compiled
    faster, but MXML is better for being self documenting even if it
    requires more verbosity.
    Sean
    Matt Chotin wrote:
    A new message was posted by Matt Chotin in
    Developers --
      specify the GUI declaratively in ActionScript like in JavaFX Script
    instead of MXML
    I'd be curious what other people think.  I see MXML as a distinct
    advantage over doing the pseudo-script stuff.  I really don't like
    the JavaFX system actually.
    Matt
    On 9/28/08 10:33 AM, "neo7471"
    <[email protected]> wrote:
    A new discussion was started by neo7471 in
    Developers --
      specify the GUI declaratively in ActionScript like in JavaFX Script
    instead of MXML
    After reading a bit about JavaFX Script (which is actually remarkebly
    close to ActionScript 3) as a developer I thought the way one can
    specify the GUI declaratively in JavaFX Script via JSON-like notation
    for the components is pretty cool. It would be nice to have something
    like that in Flex/ActionScript too. The advantages I see over MXML are:
    1) a more compact notation than XML which is nice from a developers
    view point who actually writes this kind of code. Of course the idea
    would be that designers still design the GUI with graphical tools
    that generate this code but if you have to dive in and edit the code
    it's nice not to have to deal with verbose XML and I think even
    designers can easily understand JSON-like code; don't just assume
    that designers love XML because HTML was based on SGML! I'm not so
    sure if today many designers really still know raw HTML that well
    (like in the 1997, the early days...). Server side developers
    probably know it better because they! have to adapt it to jsp or asp
    or whatever framework.
    2) The fact that it's all ActionScript gives a seamless integration
    between just composing the components to form the GUI and adding
    scripts to add additionial behavior instead of mixing XML with
    actionscript code => no more need for those naster CDATA blocks! It
    would also be easy for development tools like Flexbuilder to give a
    seamsless experience with code completion and zooming in on the code
    because it's all Actionscript! There's also no need for a separate
    expression language to tie the MXML to the underlying Actionscript.
    It would it also make easier to create custom components (not just
    simple composition components which is really easy in MXML) because
    you don't have to implement separate XML tags.
    here's a short JavaFX Script example:
    Frame {
        content: GroupPanel {
        var myRow = Row { alignment: BASELINE }
        var label_col = Column { alignment: TRAILING }
        var field_col = Column { alignment: LEADING  }
        rows: [myRow]
        columns: [label_col, field_col]
        content:
        [SimpleLabel {
        row: myRow
        column: label_col
        text: "Type your text here:"
        TextField {
        row: myRow
        column: field_col
        columns: 50
        visible: true
    Note that this shouldn't be confused with programmatically specifying
    the GUI in Actionscript (which is possible today as an alternative to
    MXML). What I propose is at a (slightly) higher level: you don't give
    a detailed sequence of methods/functions to call to construct the GUI
    (i.e. HOW to do it) but just specify WHAT you want.
    Hopefully some Adobe Flex will see this and think about it. Although
    I think MXML is not too bad and I can live with it if I have to ;)
    View/reply at specify the GUI declaratively in ActionScript like in
    JavaFX Script instead of MXML
    <
    http://www.adobeforums.com/webx?13@@.59b69b42>
    Replies by email are OK.
    Use the unsubscribe
    <
    http://www.adobeforums.com/webx?280@@.59b69b42!folder=.3c060fa3>
    form to cancel your email subscription.
    View/reply at
    <
    http://www.adobeforums.com/webx?13@@.59b69b42/0>
    Replies by email are OK.
    Use the unsubscribe form at
    <
    http://www.adobeforums.com/webx?280@@.59b69b42!folder=.3c060fa3> to
    cancel your email subscription.
    <div><div></div><div>
    Jason Stafford
    Principal Developer
    Inspiration Software, Inc.
    The leader in visual thinking & learning
    Now available - Kidspiration(r) 3, the visual way to explore and understand words, numbers and concepts.
    Learn more at
    www.inspiration.com/kidspiration.
    503-297-3004 Extension 119
    503-297-4676 (Fax)
    9400 SW Beaverton-Hillsdale Highway
    Suite 300
    Beaverton, OR 97005-3300
    View/reply at
    <
    http://www.adobeforums.com/webx?13@@.59b69b42/2>
    Replies by email are OK.
    Use the unsubscribe form at
    <
    http://www.adobeforums.com/webx?280@@.59b69b42!folder=.3c060fa3></div>
    </div> to cancel your email subscription.
    Sean Christmann | Experience Architect | EffectiveUI | 720.937.2696
    View/reply at
    specify the GUI declaratively in ActionScript like in JavaFX Script instead of MXML
    Replies by email are OK.
    Use the
    unsubscribe form to cancel your email subscription.
    "Therefore, send not to know For whom the bell tolls. It tolls for thee."
    http://flex.joshmcdonald.info/
    :: Josh 'G-Funk' McDonald
    :: 0437 221 380 ::
    [email protected]

  • Code and GUI Elements Altered When Working Between Windows 8, and = Windows 7

    This is not the usual "My fonts look different" problem we get when running application executables on different PCs.  The bug I am seeling (yes, I'm calling it a bug) is that when I bring up code to work on in Windows 8, several things change, both in the GUI and source panes.
    1. Controls and indicators are scaled differently, moved, and frequently no longer aligned with the grid.
    2. In structures like the timed loop, the parameter text is oversized, and only partially visible.  Changing font settings in Options has no effect.
    3. Floating constants (not wired to anything) can show up in unpredictable places.  Even wired up code seems to move around.
    4. Maybe unrelated, but WIndows 8 sucks.  Sorry, just had to get that out.
    This is a serious problem which affects my productivity, as I cannot work on my code outside of my office, without creating more work for myself when I get back in.  The obvious solution would be to downgrade my laptop to Windows 7, but of course THAT OS no longer exists as far as Microsoft is concered.

    Norbert_B wrote:
    Hm, i have no experience with Windows 8 yet, so i cannot refer to your specific question/remarks.
    But:
    When switching my laptop to a newer one (the old running Win 7 32bit, the new Win7 64bit), i encountered some severe graphics issue with LV as well.
    I found out, that my new laptop was configured to display "text and other items" with 125% (setting can be found in Control Panel>>Appearance and Personalization>>Display.
    After changing this setting back to 100%, most things work fine now in LV.
    Another point is (what i don't understand) that LV chose to preconfigure the three default font-collection (Application, Dialog, System) to be of size 20. My old machine had 15.
    If you have VIs already displaying fonts at this size, you have to select all controls (Ctrl+a) and THEN change font size. Otherwise, it will not affect existing controls.
    hope this helps,
    Norbert
    That is the Windows way of adjusting for displays with higher DPI, since the text can get very small with 150dpi displays rather than the standard 96dpi, Windows was originally designed for. Since the Windows graphic system is still mostly pixel based also for fonts, there is no other easy way to allow making text more readable. This scaling however messes with any graphic system that works on pixels rather than a virtual resolution and is one reason Retina style displays won't be a good option for Windows machines for some time to come.
    The font size change is also because of that. LabVIEW detects at startup that the screen resolution is rather high and tries to correct for this. But together with the Windows screen scaling this makes things look even worse. Unfortunately there is no simple solution for this. Windows has over the time attempted to fix such issues in so many different and often incompatible ways, that there exist simply to many variables to make a program detect all possible  incarnations of user and system adjustable settings and account for them.
    I'm sure there is room for LabVIEW to improve on this, but there is simply no way to make it work seemlessly for all possible configurations.
    A long time ago someone designed a Next cube device that used Display Postscript as graphical output system. This Display Postscript had a true virtual resolution system and made the idea of having graphical output look the same on any kind of display or printer feasable. Unfortunately and despite working together with graphic chip manaufacturers it never made it as such into mainstream hardware. Supposedly partly because the performance was significantly less than other systems and therefore was never considered good enough for the main driving force in graphics developmen (games) but possibly also because the drivers were significantly more complex and there was not that much interest to dig that complexity.
    MacOS X uses some of the concepts of the Next cube but abandoned Display Postscript for a somewhat more traditional approach. But Windows has still a lot to catch up in that area, if they ever do.
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • How to left align the signature field of dynamic pdf

    Hi,
    I am working on dynamic (interactive) pdf and using Adobe LiveCycle Designer (Adobe Acrobat 9 Pro). My problem is that I cannot align left the signature field of my pdf. I can align left, right and center for textboxs and cannot just do that for signature field. When I couldn't do that from GUI I went to XML code for signature and tried this:
                       <para hAlign="left"/>  but it still didn't work. Ideally it should have worked.
    I would really appreciate if you could help me.
    Regards,
    Kiran

    Use skinning. Use the following skin selector:
    af|panelFormLayout::label-cell {text-align: left; }If you want to apply it only on particular panelFormLayout, then set a custom styleClass on the given <af:panelFormLayout> tag (for example, <af:panelFormLayout styleClass="MyStyleClass" ... >) and use a styleClass-dependent skin selector:
    af|panelFormLayout.MyStyleClass::label-cell {text-align: left; }Adding a custom skin is easy. If you do not know how, see this topic in the documentation: 20.2 Applying Custom Skins to Applications
    Dimitar

  • How to modify  the search results of the GUI for subscribing to calendars

    How to modify the search results of the GUI for subscribing to calendars
    Note:
    <OL>
    <LI>The following information applies only to iPlanet Calendar Server 5.0
    Patch 3.
    <LI>All of the cases for which the XSLT changes will work have not been
    verified.
    <LI>The following is only an example of an XSLT customization.
    </OL>
    The example below shows a sample customization of the
    search_for_calendars
    dialog. This customization will result in the Display Name being included as
    part of the search results in the GUI, which would normally show just the
    calendar ID. It will render the returned calendars in the following format:
    <P>
    Display Name - <I>description</I>
    <P>
    Normally, the format would be as follows:
    <P>
    Calendar-ID - <I>description</I>
    <P>
    </A>
    The example consists of the following two files:
    <P>
    <OL>
    <LI>search_for_calendars_common.xsl
    (the entire XSLT file)
    <P>
    <LI>diffctx.txt
    (the context sensitive diff patch file,
    which basically shows only the changes that need to be made)
    </OL>
    <P>
    <HR>
    </A><B>
    search_for_calendars_common.xsl</B>
    <?xml version="1.0" ?>
    <!DOCTYPE xsl:stylesheet (View Source for full doctype...)>
    - <!--
    set the output properties
    <xsl:stylesheet
    xmlns:xsl="http://www.w3.org/XSL/Transform/1.0"
    result-ns="http://www.w3.org/TR/REC-html40">
    -->
    - <xsl:stylesheet xmlns:xsl="http://www.w3.org/XSL/Transform/1.0">
    - <!-- set the output properties
    -->
    <xsl:output method="html" encoding="ISO-8859-1" />
    <xsl:include href="data/common.xsl" />
    <xsl:include href="data/i18n.xsl" />
    <xsl:include href="data/date_format.xsl" />
    <xsl:include href="data/dialog_tabs.xsl" />
    - <xsl:template match="/">
    <xsl:apply-templates select="calendar" />
    </xsl:template>
    - <xsl:template match="calendar">
    - <xsl:choose>
    - <xsl:when test="@top='true'">
    - <xsl:variable name="Frame1">
    <xsl:value-of select="frame[1]" />
    </xsl:variable>
    - <xsl:variable name="Frame2">
    <xsl:value-of select="frame[2]" />
    </xsl:variable>
    - <xsl:variable name="Frame3">
    <xsl:value-of select="frame[3]" />
    </xsl:variable>
    - <xsl:variable name="tab_value">
    <xsl:value-of select="@tab" />
    </xsl:variable>
    - <HTML>
    - <HEAD>
    <xsl:call-template name="contextJavascript" />
    <TITLE>Calendars Search: Calendar Express - iPlanet</TITLE>
    </HEAD>
    - <FRAMESET border="0" frameborder="0" rows="77,*,71">
    <FRAME name="tab" marginheight="0" marginwidth="0" scrolling="no"
    scrollbars="no" src="{$Frame1}" />
    <FRAME name="main" frameborder="0" src="{$Frame2}" />
    <FRAME name="button" marginheight="0" marginwidth="0" scrolling="no"
    scrollbars="no" frameborder="0" src="{$Frame3}" />
    </FRAMESET>
    </HTML>
    </xsl:when>
    - <xsl:when test="@view='searchProperties'">
    - <xsl:for-each select="group">
    - <xsl:if test="@name='searchProperties'">
    <xsl:call-template name="search_toolbar" />
    </xsl:if>
    </xsl:for-each>
    </xsl:when>
    - <xsl:when test="@view='main'">
    - <xsl:for-each select="group">
    - <xsl:if test="@name='main'">
    <xsl:call-template name="main" />
    </xsl:if>
    </xsl:for-each>
    </xsl:when>
    - <xsl:when test="@view='button'">
    - <xsl:for-each select="group">
    - <xsl:if test="@name='button'">
    <xsl:call-template name="button_root" />
    </xsl:if>
    </xsl:for-each>
    </xsl:when>
    - <xsl:otherwise>
    - <html>
    What's this view? (search_for_cals.xsl) -
    <xsl:value-of select="@view" />
    </html>
    </xsl:otherwise>
    </xsl:choose>
    </xsl:template>
    - <xsl:template name="search_toolbar">
    - <HTML>
    <xsl:call-template name="emit_frame_head_tag" />
    - <BODY bgcolor="{$bgcolor_background}" background="imx/tdbg.gif"
    marginwidth="0" marginheight="0" onload="window.focus()">
    - <FORM>
    - <xsl:attribute name="action">
    <xsl:value-of select="./formdata@action" />
    </xsl:attribute>
    <xsl:attribute name="name">form</xsl:attribute>
    <xsl:attribute name="onSubmit">document.forms[0]['find'].click(); return false;
    </xsl:attribute>
    <xsl:apply-templates select="formdata" />
    - <CENTER>
    - <TABLE border="0" cellpadding="2" cellspacing="0" width="100%" height="100%">
    - <TR>
    - <TD align="center">
    - <TABLE border="0" cellpadding="3" cellspacing="1">
    - <TR>
    - <TD colspan="4">
    <FONT size="{$font_size_big_2}" face="{$font_name}">Find all calendars where
    the calendar</FONT>
    </TD>
    </TR>
    - <TR>
    - <TD valign="baseline">
    - <FONT size="{$font_size_big_2}" face="{$font_name}">
    - <SELECT name="which">
    <OPTION value="name;calid">name or ID</OPTION>
    <OPTION value="name">name</OPTION>
    <OPTION value="primaryOwner">primary owner</OPTION>
    <OPTION value="calid">ID</OPTION>
    </SELECT>
    </FONT>
    </TD>
    - <TD valign="baseline">
    - <FONT size="{$font_size_big_2}" face="{$font_name}">
    - <SELECT name="how">
    <OPTION value="0">contains</OPTION>
    <OPTION value="1">begins with</OPTION>
    </SELECT>
    </FONT>
    </TD>
    - <TD valign="baseline">
    <INPUT type="text" name="what" />
    </TD>
    - <TD valign="baseline">
    - <FONT size="{$font_size_big_2}" face="{$font_name}">
    - <INPUT type="button" name="find" value="Find">
    - <xsl:attribute name="onClick">
    <xsl:value-of select="./button[@name='find']" />
    </xsl:attribute>
    </INPUT>
    </FONT>
    </TD>
    </TR>
    </TABLE>
    </TD>
    </TR>
    </TABLE>
    </CENTER>
    </FORM>
    </BODY>
    </HTML>
    </xsl:template>
    - <xsl:template name="main">
    - <HTML>
    <xsl:call-template name="emit_frame_head_tag" />
    - <BODY bgcolor="{$bgcolor_background}" background="imx/tdbg.gif"
    marginwidth="0" marginheight="0">
    - <FORM name="form" method="post">
    - <xsl:attribute name="action">
    <xsl:value-of select="./formdata@action" />
    </xsl:attribute>
    <xsl:attribute name="name">form</xsl:attribute>
    <xsl:apply-templates select="formdata" />
    <INPUT type="hidden" name="how" value="0" />
    <INPUT type="hidden" name="which" value="name;calid" />
    <INPUT type="hidden" name="what" value=" />
    <INPUT type="hidden" name="selectedGroup" />
    - <xsl:if test="(./calsearchresults/nomatch)">
    - <!-- print no match found
    -->
    &#38;nbsp;
    &#38;nbsp;
    No Match Found
    </xsl:if>
    - <xsl:for-each select="./calsearchresults/searchresultcal">
    - <P>
    &#38;nbsp;
    &#38;nbsp;
    - <FONT size="{$font_size_big_2}" face="{$font_name}">
    - <FONT size="{$font_size_big}" face="{$font_name}">
    Owner:
    <xsl:value-of select="@owner" />
    <FONT size="{$font_size_big}" face="{$font_name}" color="{$bgcolor_wend_mid}">|
    </FONT>
    Calendar ID:
    <xsl:value-of select="@id" />
    <BR />
    </FONT>
    - <FONT size="{$font_size_big_2}" face="{$font_name}">
    - <xsl:choose>
    - <xsl:when test="@subscribed='false'">
    &#38;nbsp;
    &#38;nbsp;
    - <INPUT type="checkbox" name="calendar">
    - <xsl:attribute name="value">
    <xsl:value-of select="@name" />
    </xsl:attribute>
    </INPUT>
    &#38;nbsp;
    &#38;nbsp;
    - <A target="_blank">
    - <xsl:attribute name="href">
    <xsl:value-of select="@viewCommand" />
    </xsl:attribute>
    <xsl:value-of select="@name" />
    </A>
    </xsl:when>
    - <xsl:otherwise>
    &#38;nbsp;
    &#38;nbsp;
    - <A target="_blank">
    - <xsl:attribute name="href">
    <xsl:value-of select="@viewCommand" />
    </xsl:attribute>
    <xsl:value-of select="@name" />
    </A>
    &#38;nbsp;
    (Subscribed)
    </xsl:otherwise>
    </xsl:choose>
    - <xsl:if test="string-length(@description) > 0">
    &#38;nbsp;
    &#38;nbsp;
    - <FONT size="{$font_size_big}" face="{$font_name}">
    <xsl:value-of select="@description" />
    </FONT>
    </xsl:if>
    </FONT>
    </FONT>
    </P>
    </xsl:for-each>
    </FORM>
    </BODY>
    </HTML>
    </xsl:template>
    </xsl:stylesheet>
    <P>
    <A HREF="#back">Back</A>
    <P>
    <HR>
    </A>
    <B>diffctx.txt</B>
    Index: search_for_calendars_common.xsl
    ===================================================================
    RCS file: /m/src/ns/server/msg/calendar/core/html/search_for_calendars_common.xsl,v
    retrieving revision 1.1.2.14
    diff -c -r1.1.2.14 search_for_calendars_common.xsl
    *** search_for_calendars_common.xsl 2000/12/12 23:10:43 1.1.2.14
    --- search_for_calendars_common.xsl 2001/03/15 23:55:19
    *** 182,188 ****
    &#38;nbsp; &#38;nbsp;
    <INPUT type="checkbox" name="calendar">
    <xsl:attribute name="value">
    ! <xsl:value-of select="@id"/>
    </xsl:attribute>
    </INPUT>
    &#38;nbsp; &#38;nbsp;
    --- 182,188 ----
    &#38;nbsp; &#38;nbsp;
    <INPUT type="checkbox" name="calendar">
    <xsl:attribute name="value">
    ! <xsl:value-of select="@name"/>
    </xsl:attribute>
    </INPUT>
    &#38;nbsp; &#38;nbsp;
    *** 190,196 ****
    <xsl:attribute name="href">
    <xsl:value-of select="@viewCommand"/>
    </xsl:attribute>
    ! <xsl:value-of select="@id"/>
    </A>
    </xsl:when>
    <xsl:otherwise>
    --- 190,196 ----
    <xsl:attribute name="href">
    <xsl:value-of select="@viewCommand"/>
    </xsl:attribute>
    ! <xsl:value-of select="@name"/>
    </A>
    </xsl:when>
    <xsl:otherwise>
    *** 199,205 ****
    <xsl:attribute name="href">
    <xsl:value-of select="@viewCommand"/>
    </xsl:attribute>
    ! <xsl:value-of select="@id"/>
    </A>
    &#38;nbsp;(Subscribed)
    </xsl:otherwise>
    --- 199,205 ----
    <xsl:attribute name="href">
    <xsl:value-of select="@viewCommand"/>
    </xsl:attribute>
    ! <xsl:value-of select="@name"/>
    </A>
    &#38;nbsp;(Subscribed)
    </xsl:otherwise>
    <P>
    <A HREF="#back">Back</A>

    Maybe on the Google API s page?

  • A GUI Question

    How do I put in a button for each day of the calender (done in this code):
    for (int i=1; i<=nod; i++)
    int row = new Integer((i+som-2)/7);
         int column = (i+som-2)%7;
         mtblCalendar.setValueAt(i, row, column);
    I want a screen that I have coded to  pop-up which has tasks for the day. This is the Window I want for to pop-up when I click the button:
    package Calender;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class MainWindow extends JFrame
         JMenuBar menubar;
         JMenu m1, m2, m3, m4;
         JMenuItem add1, remove, display, about;
         public MainWindow()
              setLayout(new FlowLayout());
              menubar = new JMenuBar();
              add(menubar);
              m1 = new JMenu("Add a task..");
              m2 = new JMenu("Remove a task..");
              m3 = new JMenu("Display tasks..");
              m4 = new JMenu("About..");
              menubar.add(m1);
              menubar.add(m2);
              menubar.add(m3);
              menubar.add(m4);
              add1 = new JMenuItem("add");
              m1.add(add1);
              remove = new JMenuItem("remove");
              m2.add(remove);
              display = new JMenuItem("display");
              m3.add(display);
              about = new JMenuItem("about");
              m4.add(about);
              setJMenuBar(menubar);
              EventA e = new EventA();
              add1.addActionListener(e);
              EventRem i = new EventRem();
              remove.addActionListener(i);
              EventDis a = new EventDis();
              display.addActionListener(a);
              EventAb b = new EventAb();
              about.addActionListener(b);
         public class EventA implements ActionListener
              public void actionPerformed(ActionEvent e)
                   AddWindow gui = new AddWindow(MainWindow.this);
                   gui.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
                   gui.setSize(500,100);
                   gui.setLocation(300,300);
                   gui.setTitle("Add a task...");
                   gui.setVisible(true);
         public class EventAb implements ActionListener
              public void actionPerformed(ActionEvent e)
                   AboutWindow gui = new AboutWindow(MainWindow.this);
                   gui.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
                   gui.setSize(500,100);
                   gui.setLocation(300,300);
                   gui.setTitle("About..");
                   gui.setVisible(true);
         public class EventRem implements ActionListener
              public void actionPerformed(ActionEvent e)
                   RemoveWindow gui = new RemoveWindow(MainWindow.this);
                   gui.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
                   gui.setSize(500,100);
                   gui.setLocation(300,300);
                   gui.setTitle("Remove a task...");
                   gui.setVisible(true);
         public class EventDis implements ActionListener
              public void actionPerformed(ActionEvent e)
                   DisplayWindow gui = new DisplayWindow(MainWindow.this);
                   gui.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
                   gui.setSize(500,100);
                   gui.setLocation(300,300);
                   gui.setTitle("Display tasks...");
                   gui.setVisible(true);
         public static void main(String[] args)
              MainWindow gui = new MainWindow();
              gui.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
              gui.setSize(500, 100);
              gui.setVisible(true);
              gui.setTitle("Main Window");
    Here is my entire calendar class:
    import javax.swing.*;
    import javax.swing.table.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.util.*;
    public class Calendar
         static JLabel lblMonth, lblYear;
         static JButton btnPrev, btnNext;
         static JTable tblCalendar;
         static JComboBox cmbYear;
         static JFrame frmMain;
         static Container pane;
         static DefaultTableModel mtblCalendar; //Table model
         static JScrollPane stblCalendar; //The scroll plane
         static JPanel pnlCalendar;
         static int realYear, realMonth, realDay, currentYear, currentMonth;
         * Changes days, months, years, etc
         public static void refreshCalendar(int month, int year)
              String[] months = {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"};
              int nod, som; //Number Of Days, Start Of Month
              //Allow/disallow buttons
              btnPrev.setEnabled(true);
              btnNext.setEnabled(true);
              if (month == 0 && year <= realYear-1){btnPrev.setEnabled(false);} //Too early
              if (month == 11 && year >= realYear+5){btnNext.setEnabled(false);} //Too late
              lblMonth.setText(months[month]); //Refresh the month label (at the top)
              lblMonth.setBounds(160-lblMonth.getPreferredSize().width/2, 25, 180, 25); //Re-align label with calendar
              cmbYear.setSelectedItem(String.valueOf(year)); //Select the correct year in the combo box
              //ImageIcon middleButtonIcon = createImageIcon("images/middle.gif");
              //Clears table
              for (int i=0; i<6; i++)
                   for (int j=0; j<7; j++)
                        mtblCalendar.setValueAt(null, i, j);
              //Get first day of month and number of days
              GregorianCalendar cal = new GregorianCalendar(year, month, 1);
              nod = cal.getActualMaximum(GregorianCalendar.DAY_OF_MONTH);
              som = cal.get(GregorianCalendar.DAY_OF_WEEK);
              //Draw calendar
              for (int i=1; i<=nod; i++)
                   int row = new Integer((i+som-2)/7);
                   int column = (i+som-2)%7;
                   mtblCalendar.setValueAt(i, row, column);
              tblCalendar.setDefaultRenderer(tblCalendar.getColumnClass(0), new tblCalendarRenderer());
         static class tblCalendarRenderer extends DefaultTableCellRenderer
              public Component getTableCellRendererComponent (JTable table, Object value, boolean selected, boolean focused, int row, int column)
                   super.getTableCellRendererComponent(table, value, selected, focused, row, column);
                   if (column == 0 || column == 6) //Week-end
                        setBackground(new Color(255, 220, 220));
                   else //Week
                        setBackground(new Color(255, 255, 255));
                   if (value != null)
                        if (Integer.parseInt(value.toString()) == realDay && currentMonth == realMonth && currentYear == realYear) //Today
                             setBackground(new Color(220, 220, 255));
                   setBorder(null);
                   setForeground(Color.black);
                   return this;
         static class GoBackAction implements ActionListener
              public void actionPerformed (ActionEvent e)
                   if (currentMonth == 0) //Back one year
                        currentMonth = 11;
                        currentYear -= 1;
                   else //Back one month
                        currentMonth -= 1;
                   refreshCalendar(currentMonth, currentYear);
         static class GoNextAction implements ActionListener
              public void actionPerformed (ActionEvent e){
                   if (currentMonth == 11){ //Foward one year
                        currentMonth = 0;
                        currentYear += 1;
                   else{ //Foward one month
                        currentMonth += 1;
                   refreshCalendar(currentMonth, currentYear);
         static class cmbYearAction implements ActionListener
              public void actionPerformed (ActionEvent e)
                   if (cmbYear.getSelectedItem() != null)
                        String b = cmbYear.getSelectedItem().toString();
                        currentYear = Integer.parseInt(b);
                        refreshCalendar(currentMonth, currentYear);
         public static void main (String args[])
              try {UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());}
              catch (ClassNotFoundException e) {}
              catch (InstantiationException e) {}
              catch (IllegalAccessException e) {}
              catch (UnsupportedLookAndFeelException e) {}
              //makes the frame for the console
              frmMain = new JFrame ("APCS Calender"); //Create frame
              frmMain.setSize(330, 375); //Set size to 400x400 pixels
              pane = frmMain.getContentPane(); //Get content pane
              pane.setLayout(null); //Apply null layout
              frmMain.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //Close when X is clicked
              //Creates the controls for the screan
              lblMonth = new JLabel ("January");
              lblYear = new JLabel ("Change year:");
              cmbYear = new JComboBox();
              btnPrev = new JButton ("<<");
              btnNext = new JButton (">>");
              mtblCalendar = new DefaultTableModel(){public boolean isCellEditable(int rowIndex, int mColIndex){return false;}};
              tblCalendar = new JTable(mtblCalendar);
              stblCalendar = new JScrollPane(tblCalendar);
              pnlCalendar = new JPanel(null);
              //Sets the border for the screen
              pnlCalendar.setBorder(BorderFactory.createTitledBorder("Calendar"));
              btnPrev.addActionListener(new GoBackAction());
              btnNext.addActionListener(new GoNextAction());
              cmbYear.addActionListener(new cmbYearAction());
              //Add controls to screen
              pane.add(pnlCalendar);
              pnlCalendar.add(lblMonth);
              pnlCalendar.add(lblYear);
              pnlCalendar.add(cmbYear);
              pnlCalendar.add(btnPrev);
              pnlCalendar.add(btnNext);
              pnlCalendar.add(stblCalendar);
              //Set boundaries for day, month, year
              pnlCalendar.setBounds(0, 0, 320, 335);
              lblMonth.setBounds(160-lblMonth.getPreferredSize().width/2, 25, 100, 25);
              lblYear.setBounds(10, 305, 80, 20);
              cmbYear.setBounds(230, 305, 80, 20);
              btnPrev.setBounds(10, 25, 50, 25);
              btnNext.setBounds(260, 25, 50, 25);
              stblCalendar.setBounds(10, 50, 300, 250);
              //Make frame visible
              frmMain.setResizable(false);
              frmMain.setVisible(true);
              //Gets the real month, year and day
              GregorianCalendar cal = new GregorianCalendar(); //Create calendar
              realDay = cal.get(GregorianCalendar.DAY_OF_MONTH); //Get day
              realMonth = cal.get(GregorianCalendar.MONTH); //Get month
              realYear = cal.get(GregorianCalendar.YEAR); //Get year
              currentMonth = realMonth; //Match month and year
              currentYear = realYear;
              //Add headers to screen
              String[] headers = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"}; //All headers
              for (int i=0; i<7; i++){
                   mtblCalendar.addColumn(headers);
              tblCalendar.getParent().setBackground(tblCalendar.getBackground()); //Set background
              //Makes it so that you can't resize or reorder
              tblCalendar.getTableHeader().setResizingAllowed(false);
              tblCalendar.getTableHeader().setReorderingAllowed(false);
              tblCalendar.setColumnSelectionAllowed(true);
              tblCalendar.setRowSelectionAllowed(true);
              tblCalendar.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
              //Set row and column count
              tblCalendar.setRowHeight(38);
              mtblCalendar.setColumnCount(7);
              mtblCalendar.setRowCount(6);
              //puts values in the table
              for (int i=realYear-1; i<=realYear+5; i++)
                   cmbYear.addItem(String.valueOf(i));
              //Refresh calendar
              refreshCalendar (realMonth, realYear); //Refresh calendar

    Moderator action: Moved from Java Programming.
    Moderator advice: Please read the announcement(s) at the top of the forum listings and the FAQ linked from every page. They are there for a purpose.
    Then edit your post and format the code correctly.
    db

  • Sudoku GUI

    Hey am trying to create a GUI for my Sudoku board.
    Here is how it currently looks: (See code below)
    There are two things I wanna change
    1. How do I center align the number so they are not stuck to the right edge as they are now?
    2. How do I add a bolder line around blocks/boxes(e.g. the 3*3 sections). Im sure these are pretty easy but havent been able to figure it out as of yet!
    Any help would be greatly appreciated.
    Code:
    package proj.sudoku.gui;
    import java.awt.Color;
    import java.awt.Component;
    import java.awt.Cursor;
    import java.awt.Font;
    import java.awt.GridBagConstraints;
    import java.awt.GridBagLayout;
    import java.awt.Insets;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.awt.event.InputMethodEvent;
    import java.awt.event.InputMethodListener;
    import java.beans.PropertyChangeEvent;
    import java.beans.PropertyChangeListener;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    import javax.swing.JTable;
    import javax.swing.JTextArea;
    import javax.swing.JTextField;
    import javax.swing.SwingConstants;
    import javax.swing.table.AbstractTableModel;
    import javax.swing.table.DefaultTableCellRenderer;
    import proj.sudoku.representation.Board;
    import proj.sudoku.representation.Square;
    import proj.sudoku.ui.Sudoku;
    public class SudokuGUI extends JFrame implements ActionListener{
    private JTextField unfilledSquaresTextField;
    private JTextArea messagesTextArea;
    private JTable boardTable;
    private Board board;
    private Sudoku sudoku = new Sudoku();
    private int noOfUnfilledSquares = 20;
    private static final long serialVersionUID = 1L;
    class BoardTableTableModel extends AbstractTableModel {
    public final String[] COLUMN_NAMES = { "Row 0", "Row 1", "Row 2", "Row 3", "Row 4", "Row 5", "Row 6", "Row 7", "Row 8"};
    public int getRowCount() {
    return 9;
    public int getColumnCount() {
    return COLUMN_NAMES.length;
    public String getColumnName(int columnIndex) {
    return COLUMN_NAMES[columnIndex];
    public Object getValueAt(int rowIndex, int columnIndex) {
    int squareValue = board.getSquare(rowIndex, columnIndex).getSquareValue();
    if(squareValue == 0){
    return null;
    }else{
    return new Integer(squareValue);
    public boolean isCellEditable(int row, int col){
    return true;
    public void setValueAt(Object value, int row, int col) {
    int intValue = ((Integer)value).intValue();
    if((intValue >= 0) && (intValue < 10)){
    Square square = board.getSquare(row, col);
    square.setSquareValue(((Integer)value).intValue());
    board.setSquare(square, row, col);
    fireTableCellUpdated(row, col);
    public Class getColumnClass(int c) {
    return Integer.class;
    * Create the frame
    public SudokuGUI(Board newBoard) {
    super();
    getContentPane().setBackground(new Color(128, 128, 255));
    board = newBoard;
    getContentPane().setLayout(new GridBagLayout());
    setTitle("Sudoku Sudokme");
    setBounds(100, 100, 607, 456);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    final JPanel tablePanel = new JPanel();
    tablePanel.setLayout(new GridBagLayout());
    final GridBagConstraints gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.weighty = 0.5;
    gridBagConstraints.weightx = 1;
    getContentPane().add(tablePanel, gridBagConstraints);
    boardTable = new JTable();
    boardTable.setRowHeight(40); // TODO This line has been changed
    boardTable.setFont(new Font("", Font.PLAIN, 20));// TODO This line has been changed
    boardTable.setCursor(Cursor.getPredefinedCursor(Cursor.TEXT_CURSOR));
    boardTable.setRowSelectionAllowed(false);
    boardTable.setShowGrid(true);
    boardTable.setModel(new BoardTableTableModel());
    final GridBagConstraints gridBagConstraints_2 = new GridBagConstraints();
    gridBagConstraints_2.gridx = 0;
    gridBagConstraints_2.gridy = 0;
    gridBagConstraints_2.insets = new Insets(0, -265, 0, 0);// TODO This line has been changed
    //gridBagConstraints_2.insets = new Insets(5, -265, 5, 0);
    tablePanel.add(boardTable, gridBagConstraints_2);
    final JPanel messagesPanel = new JPanel();
    messagesPanel.setLayout(new GridBagLayout());
    final GridBagConstraints gridBagConstraints_6 = new GridBagConstraints();
    gridBagConstraints_6.weighty = 0.3;
    gridBagConstraints_6.weightx = 1.0;
    gridBagConstraints_6.gridy = 1;
    gridBagConstraints_6.gridx = 0;
    getContentPane().add(messagesPanel, gridBagConstraints_6);
    messagesTextArea = new JTextArea();
    messagesTextArea.setAlignmentY(Component.BOTTOM_ALIGNMENT);
    messagesPanel.add(messagesTextArea, new GridBagConstraints());
    messagesTextArea.setText(board.getMessage());
    messagesTextArea.setEditable(false);
    final JPanel generateButtonPanel = new JPanel();
    generateButtonPanel.setLayout(new GridBagLayout());
    final GridBagConstraints gridBagConstraints_3 = new GridBagConstraints();
    gridBagConstraints_3.gridy = 2;
    gridBagConstraints_3.gridx = 0;
    getContentPane().add(generateButtonPanel, gridBagConstraints_3);
    final JButton generateEmptyBoardButton = new JButton();
    generateEmptyBoardButton.addActionListener(this);
    generateEmptyBoardButton.setText("Generate Empty Board");
    final GridBagConstraints gridBagConstraints_9 = new GridBagConstraints();
    gridBagConstraints_9.gridy = 0;
    gridBagConstraints_9.gridx = 0;
    generateButtonPanel.add(generateEmptyBoardButton, gridBagConstraints_9);
    final JButton generateBoardButton = new JButton();
    generateBoardButton.addActionListener(this);
    generateBoardButton.setText("Generate Board");
    final GridBagConstraints gridBagConstraints_10 = new GridBagConstraints();
    gridBagConstraints_10.gridx = 2;
    generateButtonPanel.add(generateBoardButton, gridBagConstraints_10);
    final JLabel unfilledSquaresLabel = new JLabel();
    unfilledSquaresLabel.setText("Unfilled Squares");
    final GridBagConstraints gridBagConstraints_11 = new GridBagConstraints();
    gridBagConstraints_11.gridy = 0;
    gridBagConstraints_11.gridx = 3;
    generateButtonPanel.add(unfilledSquaresLabel, gridBagConstraints_11);
    unfilledSquaresTextField = new JTextField();
    unfilledSquaresTextField.setFont(new Font("", Font.BOLD, 14));
    unfilledSquaresTextField.addActionListener(this);
    unfilledSquaresTextField.setText(new Integer(noOfUnfilledSquares).toString());
    unfilledSquaresTextField.setBackground(Color.WHITE);
    final GridBagConstraints gridBagConstraints_12 = new GridBagConstraints();
    gridBagConstraints_12.gridy = 0;
    gridBagConstraints_12.gridx = 4;
    unfilledSquaresLabel.setLabelFor(unfilledSquaresTextField);
    generateButtonPanel.add(unfilledSquaresTextField, gridBagConstraints_12);
    final JPanel solveButtonsPanel = new JPanel();
    solveButtonsPanel.setRequestFocusEnabled(false);
    solveButtonsPanel.setLayout(new GridBagLayout());
    final GridBagConstraints gridBagConstraints_1 = new GridBagConstraints();
    gridBagConstraints_1.weighty = 0.1;
    gridBagConstraints_1.weightx = 1;
    gridBagConstraints_1.gridy = 3;
    gridBagConstraints_1.gridx = 0;
    getContentPane().add(solveButtonsPanel, gridBagConstraints_1);
    final JButton heuristicsSolveButton = new JButton();
    heuristicsSolveButton.addActionListener(this);
    heuristicsSolveButton.setText("Heuristics Solve");
    final GridBagConstraints gridBagConstraints_4 = new GridBagConstraints();
    gridBagConstraints_4.gridx = 0;
    solveButtonsPanel.add(heuristicsSolveButton, gridBagConstraints_4);
    final JButton bruteForceSolveButton = new JButton();
    bruteForceSolveButton.addActionListener(this);
    bruteForceSolveButton.setText("Brute Force Solve");
    final GridBagConstraints gridBagConstraints_7 = new GridBagConstraints();
    gridBagConstraints_7.gridx = 1;
    solveButtonsPanel.add(bruteForceSolveButton, gridBagConstraints_7);
    final JButton hybridSolveButton = new JButton();
    hybridSolveButton.addActionListener(this);
    hybridSolveButton.setText("Hybrid Solve");
    final GridBagConstraints gridBagConstraints_8 = new GridBagConstraints();
    gridBagConstraints_8.gridx = 2;
    solveButtonsPanel.add(hybridSolveButton, gridBagConstraints_8);
    final JPanel testButtonsPanel = new JPanel();
    testButtonsPanel.setLayout(new GridBagLayout());
    final GridBagConstraints gridBagConstraints_5 = new GridBagConstraints();
    gridBagConstraints_5.weighty = 0.1;
    gridBagConstraints_5.weightx = 1.0;
    gridBagConstraints_5.gridy = 4;
    gridBagConstraints_5.gridx = 0;
    getContentPane().add(testButtonsPanel, gridBagConstraints_5);
    final JButton checkIfValidButton = new JButton();
    checkIfValidButton.addActionListener(this);
    checkIfValidButton.setText("Check If Valid");
    testButtonsPanel.add(checkIfValidButton, new GridBagConstraints());
    final JButton checkIfLegalButton = new JButton();
    checkIfLegalButton.addActionListener(this);
    checkIfLegalButton.setText("Check If Legal");
    testButtonsPanel.add(checkIfLegalButton, new GridBagConstraints());
    public static void main(String args[]) {
    try {
    SudokuGUI frame = new SudokuGUI(new Board());
    frame.setVisible(true);
    //frame.pack();
    } catch (Exception e) {
    e.printStackTrace();
    public void actionPerformed(ActionEvent arg0) {
    if(arg0.getSource().getClass().getName().equals("javax.swing.JTextField")){
    noOfUnfilledSquares = new Integer(((JTextField)arg0.getSource()).getText()).intValue();
    this.repaint();
    }else{
    try{
    board = sudoku.processGUICommands(board, arg0.getActionCommand(), noOfUnfilledSquares);
    messagesTextArea.setText(board.getMessage());
    this.repaint();
    }catch(Exception e){
    e.printStackTrace();
    }

    1) Use the [url http://forum.java.sun.com/help.jspa?sec=formatting]Code Formatting Tags when posting code so the code is readable
    2) The code you posted isn't compileable or executable so we see exactly what you layout looks like
    3) If you have a Grid type layout, then I would think a GridLayout would be more appropriate to use then the GridBagLayout. Read the Swing tutorial on [url http://java.sun.com/docs/books/tutorial/uiswing/layout/visual.html]How to Use Layout Managers for more information.
    How do I add a bolder line around blocks/boxes[url http://java.sun.com/docs/books/tutorial/uiswing/misc/border.htmlHow to Use Borders[/url]
    If you need further help then you need to create a [url http://homepage1.nifty.com/algafield/sscce.html]Short, Self Contained, Compilable and Executable, Example Program that demonstrates the incorrect behaviour, because I can't guess exactly what you are doing based on the information provided.

  • GUI - Using NetBeans

    Hi,
    I am new to using NetBeans and have built a basic GUI using it. However, I want to change the background colour of my GUI to black and cant see how to do this using NetBeans. Please could someone explain to me how to do this.
    My code is as follows :-
    * GUIII.java
    * Created on 29 November 2007, 19:47
    package my.GUIII;
    public class GUIII extends javax.swing.JFrame {
    /** Creates new form GUIII */
    public GUIII() {
    initComponents();
    /** This method is called from within the constructor to
    * initialize the form.
    * WARNING: Do NOT modify this code. The content of this method is
    * always regenerated by the Form Editor.
    // <editor-fold defaultstate="collapsed" desc="Generated Code">
    private void initComponents() {
    jLabel1 = new javax.swing.JLabel();
    jDialog1 = new javax.swing.JDialog();
    jPanel1 = new javax.swing.JPanel();
    jButton5 = new javax.swing.JButton();
    jButton4 = new javax.swing.JButton();
    jButton3 = new javax.swing.JButton();
    jButton2 = new javax.swing.JButton();
    jButton1 = new javax.swing.JButton();
    jLabel2 = new javax.swing.JLabel();
    jLabel1.setText("jLabel1");
    javax.swing.GroupLayout jDialog1Layout = new javax.swing.GroupLayout(jDialog1.getContentPane());
    jDialog1.getContentPane().setLayout(jDialog1Layout);
    jDialog1Layout.setHorizontalGroup(
    jDialog1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addGap(0, 400, Short.MAX_VALUE)
    jDialog1Layout.setVerticalGroup(
    jDialog1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addGap(0, 300, Short.MAX_VALUE)
    setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
    setTitle("Guiness Rugby League");
    setBackground(new java.awt.Color(0, 0, 0));
    jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(""));
    jButton5.setText("Exit");
    jButton4.setText("Clear");
    jButton3.setText("Update Database");
    jButton2.setText("Read Database");
    jButton1.setText("Read File");
    jButton1.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    jButton1ActionPerformed(evt);
    javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
    jPanel1.setLayout(jPanel1Layout);
    jPanel1Layout.setHorizontalGroup(
    jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
    .addComponent(jButton1)
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
    .addComponent(jButton2)
    .addGap(18, 18, 18)
    .addComponent(jButton3)
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
    .addComponent(jButton4)
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
    .addComponent(jButton5)
    .addGap(36, 36, 36))
    jPanel1Layout.setVerticalGroup(
    jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addGroup(jPanel1Layout.createSequentialGroup()
    .addGap(20, 20, 20)
    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
    .addComponent(jButton1)
    .addComponent(jButton3)
    .addComponent(jButton4)
    .addComponent(jButton5)
    .addComponent(jButton2))
    .addContainerGap(21, Short.MAX_VALUE))
    jLabel2.setIcon(new javax.swing.ImageIcon("C:\\Users\\Blampied\\Desktop\\P_GPremLogo.gif")); // NOI18N
    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(
    layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addGroup(layout.createSequentialGroup()
    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addGroup(layout.createSequentialGroup()
    .addGap(117, 117, 117)
    .addComponent(jLabel2))
    .addGroup(layout.createSequentialGroup()
    .addGap(25, 25, 25)
    .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 457, javax.swing.GroupLayout.PREFERRED_SIZE)))
    .addContainerGap(42, Short.MAX_VALUE))
    layout.setVerticalGroup(
    layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addGroup(layout.createSequentialGroup()
    .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 76, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 446, Short.MAX_VALUE)
    .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addContainerGap())
    pack();
    }// </editor-fold>
    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
    // TODO add your handling code here:
    * @param args the command line arguments
    public static void main(String args[]) {
    java.awt.EventQueue.invokeLater(new Runnable() {
    public void run() {
    new GUIII().setVisible(true);
    // Variables declaration - do not modify
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    private javax.swing.JButton jButton3;
    private javax.swing.JButton jButton4;
    private javax.swing.JButton jButton5;
    private javax.swing.JDialog jDialog1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JPanel jPanel1;
    // End of variables declaration
    }

    Use Component's setBackground method; See this tutorial that has examples of its use:
    http://java.sun.com/docs/books/tutorial/uiswing/components/jcomponent.html
    Please post future Swing questions in the Swing forum.

  • ALIGNING LABEL TEXT

    Hi people, could I please get a hand I am stuck. I need to center the text of label in my gui. What does the method setHorizontalAlignment(int Alignment) mean??? How do I incorporate it into my program? The JAVA Api is difficult to understand.
    Your java pal

    if the Java API is difficult to understand for you, my advice is
    1.) Stop coding ...
    2.) Go to the "New to Java" forum
    3.) Do more testing

Maybe you are looking for