Frames and buttons

hi...i've just created an Japplet with a jbutton on it,on clicking d jbutton a new jframe shud be opened but m unable to do so...can somebody help me...

swatibhatnagar wrote:
hi...i've just created an Japplet with a jbutton on it,on clicking d jbutton a new jframe shud be opened but m unable to do so...can somebody help me...not a jframe, a JDialog. and please read the ### manuals (Sun tutorials) as recommended previously:
http://forum.java.sun.com/thread.jspa?threadID=5273150
Also you may wish to use standard English if you want folks to take your posts seriously. There is no extra charge for typing out your words fully.

Similar Messages

  • Buttons does not work if you leave button frame and return

    I have some simple buttons that work fine until i leave the frame the buttons are on a go to another frame. When i return the buttons are dead. This is how aI  set up listeners and handlers:
    //event listeners for tour screen buttons
    detailsMovieClip_mc.tour0.addEventListener(MouseEvent.CLICK, tour0_click);
    detailsMovieClip_mc.tour0.addEventListener(MouseEvent.ROLL_OVER, tour0_over);
    detailsMovieClip_mc.tour0.addEventListener(MouseEvent.ROLL_OUT, tour0_out);
    function tour0_click(Event:MouseEvent):void
    //do something
    function tour0_over(Event:MouseEvent):void
    //do something
    function tour0_out(Event:MouseEvent):void
    //do something
    any idea why this is happening?

    An object with its alpha property set to zero remains interactive regardless that you can't see it.  When I said to make them visible/invisible I meant set the buttons' visible property to true/false as needed.

  • Adjust position and size of textField and button...

    Dear All,
    I have the following sample program which has a few textFields and a button, but the positions are not good. How do I make the textField to be at the right of label and not at the bottom of the label ? Also how to adjust the length of textField and button ? The following form design looks ugly. Please advise.
    import javax.swing.*; //This is the final package name.
    //import com.sun.java.swing.*; //Used by JDK 1.2 Beta 4 and all
    //Swing releases before Swing 1.1 Beta 3.
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.text.*;
    import javax.swing.JTable;
    import javax.swing.JScrollPane;
    import javax.swing.JPanel;
    import javax.swing.JFrame;
    public class SwingApplication extends JFrame {
    private static String labelPrefix = "Number of button clicks: ";
    private int numClicks = 0;
    String textFieldStringVEHNO = "Vehicle No";
    String textFieldStringDATEOFLOSS = "Date of Loss";
    String textFieldStringIMAGETYPE = "Image Type";
    String textFieldStringIMAGEDESC = "Image Description";
    String textFieldStringCLAIMTYPE = "Claim Type";
    String textFieldStringSCANDATE = "Scan Date";
    String textFieldStringUSERID = "User ID";
    String ImageID;
    public Component createComponents() {
    //Create text field for vehicle no.
    final JTextField textFieldVEHNO = new JTextField(5);
    textFieldVEHNO.setActionCommand(textFieldStringVEHNO);
    //Create text field for date of loss.
    final JTextField textFieldDATEOFLOSS = new JTextField(10);
    textFieldDATEOFLOSS.setActionCommand(textFieldStringDATEOFLOSS);
    //Create text field for image type.
    final JTextField textFieldIMAGETYPE = new JTextField(10);
    textFieldIMAGETYPE.setActionCommand(textFieldStringIMAGETYPE);
    //Create text field for image description.
    final JTextField textFieldIMAGEDESC = new JTextField(10);
    textFieldIMAGEDESC.setActionCommand(textFieldStringIMAGEDESC);
    //Create text field for claim type.
    final JTextField textFieldCLAIMTYPE = new JTextField(10);
    textFieldCLAIMTYPE.setActionCommand(textFieldStringCLAIMTYPE);
    //Create text field for scan date.
    final JTextField textFieldSCANDATE = new JTextField(10);
    textFieldSCANDATE.setActionCommand(textFieldStringSCANDATE);
    //Create text field for user id.
    final JTextField textFieldUSERID = new JTextField(10);
    textFieldUSERID.setActionCommand(textFieldStringUSERID);
    //Create some labels for vehicle no.
    JLabel textFieldLabelVEHNO = new JLabel(textFieldStringVEHNO + ": ");
    textFieldLabelVEHNO.setLabelFor(textFieldVEHNO);
    //Create some labels for date of loss.
    JLabel textFieldLabelDATEOFLOSS = new JLabel(textFieldStringDATEOFLOSS + ": ");
    textFieldLabelDATEOFLOSS.setLabelFor(textFieldDATEOFLOSS);
    //Create some labels for image type.
    JLabel textFieldLabelIMAGETYPE = new JLabel(textFieldStringIMAGETYPE + ": ");
    textFieldLabelIMAGETYPE.setLabelFor(textFieldIMAGETYPE);
    //Create some labels for image description.
    JLabel textFieldLabelIMAGEDESC = new JLabel(textFieldStringIMAGEDESC + ": ");
    textFieldLabelIMAGEDESC.setLabelFor(textFieldIMAGEDESC);
    //Create some labels for claim type.
    JLabel textFieldLabelCLAIMTYPE = new JLabel(textFieldStringCLAIMTYPE + ": ");
    textFieldLabelCLAIMTYPE.setLabelFor(textFieldCLAIMTYPE);
    //Create some labels for scan date.
    JLabel textFieldLabelSCANDATE = new JLabel(textFieldStringSCANDATE + ": ");
    textFieldLabelSCANDATE.setLabelFor(textFieldSCANDATE);
    //Create some labels for user id.
    JLabel textFieldLabelUSERID = new JLabel(textFieldStringUSERID + ": ");
    textFieldLabelUSERID.setLabelFor(textFieldUSERID);
    Object[][] data = {
    {"Mary", "Campione",
    "Snowboarding", new Integer(5), new Boolean(false)},
    {"Alison", "Huml",
    "Rowing", new Integer(3), new Boolean(true)},
    {"Kathy", "Walrath",
    "Chasing toddlers", new Integer(2), new Boolean(false)},
    {"Mark", "Andrews",
    "Speed reading", new Integer(20), new Boolean(true)},
    {"Angela", "Lih",
    "Teaching high school", new Integer(4), new Boolean(false)}
    String[] columnNames = {"First Name",
    "Last Name",
    "Sport",
    "# of Years",
    "Vegetarian"};
    final JTable table = new JTable(data, columnNames);
    table.setPreferredScrollableViewportSize(new Dimension(500, 70));
    //Create the scroll pane and add the table to it.
    JScrollPane scrollPane = new JScrollPane(table);
    //Add the scroll pane to this window.
    getContentPane().add(scrollPane, BorderLayout.CENTER);
    final JLabel label = new JLabel(labelPrefix + "0 ");
    JButton buttonOK = new JButton("OK");
    buttonOK.setMnemonic(KeyEvent.VK_I);
    buttonOK.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
              try {
    numClicks++;
              ImageID = textFieldVEHNO.getText() + textFieldDATEOFLOSS.getText() + textFieldIMAGETYPE.getText();
    label.setText(labelPrefix + ImageID);
              ScanSaveMultipage doScan = new ScanSaveMultipage();
              doScan.start(ImageID);
         catch (Exception ev)
    label.setLabelFor(buttonOK);
    * An easy way to put space between a top-level container
    * and its contents is to put the contents in a JPanel
    * that has an "empty" border.
    JPanel pane = new JPanel();
    pane.setBorder(BorderFactory.createEmptyBorder(
    20, //top
    30, //left
    30, //bottom
    20) //right
    pane.setLayout(new GridLayout(0, 1));
         pane.add(textFieldLabelVEHNO);
         pane.add(textFieldVEHNO);
         pane.add(textFieldLabelDATEOFLOSS);
         pane.add(textFieldDATEOFLOSS);
         pane.add(textFieldLabelIMAGETYPE);
         pane.add(textFieldIMAGETYPE);
         pane.add(textFieldLabelIMAGEDESC);
         pane.add(textFieldIMAGEDESC);
         pane.add(textFieldLabelCLAIMTYPE);
         pane.add(textFieldCLAIMTYPE);
         pane.add(textFieldLabelDATEOFLOSS);
         pane.add(textFieldDATEOFLOSS);
         pane.add(textFieldLabelUSERID);
         pane.add(textFieldUSERID);
    pane.add(buttonOK);
         pane.add(table);
    //pane.add(label);
    return pane;
    public static void main(String[] args) {
    try {
    UIManager.setLookAndFeel(
    UIManager.getCrossPlatformLookAndFeelClassName());
    } catch (Exception e) { }
    //Create the top-level container and add contents to it.
    JFrame frame = new JFrame("SwingApplication");
    SwingApplication app = new SwingApplication();
    Component contents = app.createComponents();
    frame.getContentPane().add(contents, BorderLayout.CENTER);
    //Finish setting up the frame, and show it.
    frame.addWindowListener(new WindowAdapter() {
    public void windowClosing(WindowEvent e) {
    System.exit(0);
    frame.pack();
    frame.setVisible(true);

    Post Author: Ranjit
    CA Forum: Crystal Reports
    Sorry but, i've never seen formula editor for altering position and size. If you know one please navigate me.
    I guess you have updated formula editor beside "Lock size and position" - if yes its not right. There is only one editor beside 4 items and editor is actually for Suppress.
    Anyways, A trick to change size a position is:
    Create 4-5 copies (as many as you expect positions) of the text object. place each at different positions,  right click, Format, Suppress and in formula editor for suppress write the formula: If your condition is true, Suppress=false, else true.
    Position will not change but user will feel; for different conditions -position is changed
    Hope this helps.
    Ranjit

  • Motion Menus: Placeholder and button chaos

    I am working on a menu for my DVD which includes a video background with the buttons included in it. Basically a car drives off the screen and I masked the video so when the car drives off screen the play and scenes text shows up in the street. I want the placeholder to be the last frame of the video and from what I can tell, Encore will set it to that point through the loop point. My problem is setting the two words up as buttons on that frame. I tried to edit at that point in Photoshop, but then when I preview it, only the last frame shows up and the video is no longer running. I'm not sure how far off I am here, but any help would be greatly appreciated.
    Thanks in advance,
    Rob

    I have rendered the motion menu, but my issue is in making the text from the original bg video my buttons. They don't appear until 22 seconds into the video. From what I read in the help, it says that you have to make those frames your place holder and to do that you have to set the loop point as such. I did that and then tried to do a subpicture in photoshop, but when I come back into Encore and preview, it only shows me the placeholder frame and the BG video doesn't run.

  • Problem in Frame and JSP

    hi all,
    i built an web application and now i want to add a menu using frame in HTML or javascript. The problem is all my JSP pages are data dependant from one another that means sometimes i am sending the data using input boxes and sometimes using HIDDEN values in HTML. Now i tried this followig way to use frame and to send my data to other pages but it is not working can anyone please help me.
    "DOES ANYONE KNOW WHETHER I CAN USE FRAME IN THE JSP PAGE OR NOT"
    LOGIN.HTML
    <form action="startframe.html" method="post">
    <center><h2>Employee Number:</h2></center>
    <center><input type="text" name="emplno" maxlength="4"size="4"></center></br>
    <center><h2>Password:</h2></center>
    <center><input type="password" name="pass" maxlength="6" size="6"></center></br>
    <center><input type="submit" value="SUBMIT YOUR INFO"></center>
    </form>
    </body>
    </html> DATA are GOING FROM LOGIN.HTML TO VARIFYLOGIN.JSP
    Now in between these two i used an HTML file to place a frame so that i can use the frame and the code is:
    <HTML>
    <HEAD>
    <TITLE> </TITLE>
    <frameset cols="15%,85%">>
    <frame name="frame1" src="buttons.html">
    <frame name="frame2" src="varifylogin.jsp?emplno=<%=emplno%> &pass=<%=pass%>" >
    </frameset>
    </HEAD>
    <BODY>
    </BODY>
    </HTML> "DOES ANYONE KNOW WHETHER I CAN USE FRAME IN THE JSP PAGE OR NOT"
    and then it should go to VARIFYLOGIN.JSP which is:
    String empl_no = request.getParameter("emplno");
       String password=request.getParameter("pass");
       Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver" );
       Connection con = DriverManager.getConnection("jdbc:odbc:finalmp" );
       Statement stmt = con.createStatement();
       ResultSet rs = stmt.executeQuery("SELECT StaffID,FirstName,LastName,Password FROM StaffDetails");...................................................etc.
    i am getting this error on the RIGHT hand side frame meaning it showing the buttons on the left but this error on the right:
    type Exception report
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    org.apache.jasper.JasperException
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:367)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:293)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:240)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
    root cause
    java.lang.NullPointerException
         org.apache.jsp.varifylogin_jsp._jspService(varifylogin_jsp.java:83)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:136)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:320)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:293)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:240)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:856Can anyone please help me.
    Cheers

    i am working in jubuilder
    and have made there three forms,and
    calling s-aots and st_aots in fs_aots
    but when i compile
    it takes fiel,d text on seprate page display result on other window
    why it dosent use frame here
    2nd thing
    i want to enable scrolling
    how i can do
    or how can i display required no of records in second row
    if i mention page size in any check box
    <html>
    <head>
    <title>
    fs_aots
    </title>
    </head>
    <jsp:useBean id="fs_aotsBeanId" scope="session" class="s_aots.fs_aotsBean" />
    <jsp:setProperty name="fs_aotsBeanId" property="*" />
    <body>
    <FRAMESET Rows="30%" Framespacing="0">
    <Frame Name ="Header" SRC="s_aots.jsp" Frameborder="0" Scrolling="no">
    <FRAMESET Rows="70%" Framespacing="0">
    <Frame Name="data" SRC="st_aots.jsp" Frameborder="0" Scrolling="yes">
    </frameset>
    </frameset>
    </BODY>
    </html>
    <html>
    <head>
    <title>
    s_aots
    </title>
    </head>
    <jsp:useBean id="s_aotsBeanId" scope="session" class="s_aots.s_aotsBean" />
    <jsp:setProperty name="s_aotsBeanId" property="*" />
    <body>
    <p>update database content
    <form action="st_aots.jsp" method="post">
    Region<input type=text name=Regionparam><br>
    Bill Month From :<input type=text name=BmonthFparam><br>
    Bill Month To:<input type=text name=BmonthTparam><br>
    Connection Type:<input type=text name=Conntypeparam><br>
    Exchanges:<input type=text name=Exchparam><br>
    Phone No:<input type=text name=PhoneNoparam><br>
    <input type=Submit value="Retrive from DB">
    </form>
    </BODY>
    </HTML>
    <html>
    <head>
    <title>
    st_aots
    </title>
    </head>
    <jsp:useBean id="st_aotsBeanId" scope="session" class="s_aots.st_aotsBean" />
    <jsp:setProperty name="st_aotsBeanId" property="*" />
    <%@ page language="java" import="java.util.*"%>
    <table border=1 cellpadding=0 cellspacing=0 >
    <tr><td> Phone No: </td>
    <td> Current Bill: </td>
    <td> Net Payable: </td>
    <td>Net Arrers:</td>
    <td>customer Name:</td>
    <td>Customer Address:</td>
    <td>Connection Type:</td>
    </tr>
    <%
      Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
      java.sql.Connection connection = java.sql.DriverManager.getConnection("jdbc:odbc:AOTS4");
      java.sql.Statement statement = connection.createStatement();
      Enumeration parameters = request.getParameterNames();
        if(parameters.hasMoreElements()){
        String REGION = request.getParameter("Regionparam");
        String BILL_MONTH_FROM = request.getParameter("BmonthFparam");
        String BILL_MONTH_TO = request.getParameter("BmonthTparam");
        String CONN_TYPE = request.getParameter("Conntypeparam");
        String EXCHANGES = request.getParameter("Exchparam");
        String PHONE = request.getParameter("PhoneNoparam");
       //String q;
       // statement.executeUpdate("INSERT INTO updatephonebook (LAST,FIRST,PHONE) VALUES ('"+LastValue+"','"+FirstValue+"','"+PhoneValue+"')");
    // q= " SELECT PHONE_NO,GROSS_CURRENT_BILL,AMOUNT_PAYABLE,NET_ARRERS_AMOUNT,NAME,ADDRESS_1,ADDRESS_2,ADDRESS_3,ADDRESS_4,CONNECTION_TYPE FROM AOTS WHERE REGION_CODE='" +REGION+ "' AND BILL_PERIOD BETWEEN '" + BILL_MONTH_FROM + "' AND '"+BILL_MONTH_TO+"' AND CONNECTION_TYPE='"+CONN_TYPE+"' AND EXCHANGE_CODE='"+EXCHANGES+"' AND PHONE_NO='"+PHONE+"'";
       // System.out.println(q);
         java.sql.ResultSet columns = statement.executeQuery
        (" SELECT PHONE_NO,GROSS_CURRENT_BILL,AMOUNT_PAYABLE,NET_ARRERS_AMOUNT,NAME,ADDRESS_1,ADDRESS_2,ADDRESS_3,ADDRESS_4,CONNECTION_TYPE FROM AOTS4 WHERE REGION_CODE='" +REGION+ "' AND (BILL_PERIOD BETWEEN '"+BILL_MONTH_FROM+"' AND '"+BILL_MONTH_TO+"') AND CONNECTION_TYPE='"+CONN_TYPE+"' AND EXCHANGE_CODE='"+EXCHANGES+"' AND PHONE_NO='"+PHONE+"' ")  ;
        //(" SELECT PHONE_NO,GROSS_CURRENT_BILL,AMOUNT_PAYABLE,NET_ARRERS_AMOUNT,NAME,ADDRESS_1,ADDRESS_2,ADDRESS_3,ADDRESS_4,CONNECTION_TYPE FROM AOTS4 WHERE REGION_CODE='" +REGION+ "' AND CONNECTION_TYPE='"+CONN_TYPE+"' AND EXCHANGE_CODE='"+EXCHANGES+"' AND PHONE_NO='"+PHONE+"' ")  ;
         // java.sql.ResultSet columns = statement.executeQuery(q);
       // String sql =  ("SELECT BILL_PERIOD,REGION_CODE,EXCHANGE_CODE,PHONE_NO,GROSS_CURRENT_BILL,AMOUNT_PAYABLE,NET_ARRERS_AMOUNT,NAME,ADDRESS_1,ADDRESS_2,ADDRESS_3,ADDRESS_4,CONNECTION_TYPE FROM AOTS WHERE REGION_CODE ='"+REGION+"' AND (BILL_PERIOD BETWEEN '"+BILL_MONTH_FROM+"' AND '"+BILL_MONTH_TO+"') AND CONNECTION_TYPE='"+CONN_TYPE+"' AND EXCHANGE_CODE = '"+EXCHANGES+"' AND PHONE_NO='"+PHONE+"') " );
         //System.out.println("THE SQL QUERY = " + sql);
          //java.sql.ResultSet columns = statement.executeQuery(sql);
                                while(columns.next()){
                                String Phone_No = columns.getString("PHONE_NO");
                                String G_C_Bill = columns.getString("GROSS_CURRENT_BILL");
                                String Amount_Payable= columns.getString("AMOUNT_PAYABLE");
                                String N_A_Amount= columns.getString("NET_ARRERS_AMOUNT");
                                String Name= columns.getString("NAME");
                                String Address1= columns.getString("ADDRESS_1");
                                String Address2= columns.getString("ADDRESS_2");
                                String Address3= columns.getString("ADDRESS_3");
                                String Address4= columns.getString("ADDRESS_4");
                                String C_Type= columns.getString("CONNECTION_TYPE");
    %>
                                <TR>
                                <TD> <%=Phone_No %></td>
                                <TD> <%=G_C_Bill %></td>
                                <TD> <%=Amount_Payable%></td>
                                <TD> <%=N_A_Amount %></td>
                                <TD> <%=Name %></td>
                                <TD> <%=Address1 %>,<%=Address2%>,<%=Address3%>,<%=Address4%></td>
                                <TD> <%=C_Type %></td>
                                </tr>
                                <%}
    }%>
                                </table>
                                </body>
                                </html>

  • Scrollable frames. Buttons not working.

    Hello.
    I have a problem with buttons in the scrollable frames.
    I have a slideshow with a thumb's. Each thumb consist of MSO (non active icon and active icon) and clear frame - button to that MSO and to slide foto. The thumb's grouped and placed into the frame with horizontal scroll overlay effect.
    That frame placed into another frame-pull out tab, which have vertical scroll effect. And when I pressed the button, slide fotos changes correctly, but button MSO not working.
    See files from dropbox --  https://www.dropbox.com/sh/rsbf1jto3a39jug/IVcQxaYJOW
    Sorry for my english. I need help very much.
    Thanks.

    Hi,
    I understand that I can use two 'states'  of the buttons. And I tried it. But. Buttons renditions are raster images. And on the retina display we had bad quality. My target was to create vector buttons. With good quality on both displays.
    Any suggestions?
    04.10.2013, в 12:03, Christophe_Quinzoni <[email protected]> написал(а):
    Re: Scrollable frames. Buttons not working.
    created by Christophe_Quinzoni in Digital Publishing Suite - View the full discussion
    Hi (again),
    It seems that you built your stuff in a very complicated way.
    First, try to make simple!
    You mixed MSO and buttons functions. Useless and unfonctional.
    Yous should use only button panel, with two different 'states' ('Normal' and 'Clic').
    See below (no MSO function used at all for the button):
    http://forums.adobe.com/servlet/JiveServlet/downloadImage/2-5735625-468602/445-605/Button_ 1.jpg http://forums.adobe.com/servlet/JiveServlet/downloadImage/2-5735625-468603/448-605/Button_ 2.jpg
    Use the layer panel to easily select the objects you want to modify.
    Please find your file here: https://dl.dropboxusercontent.com/u/46115208/slideshowButton.indd
    Please note that the Adobe Forums do not accept email attachments. If you want to embed a screen image in your message please visit the thread in the forum to embed the image at http://forums.adobe.com/message/5735625#5735625
    Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page: http://forums.adobe.com/message/5735625#5735625
    To unsubscribe from this thread, please visit the message page at http://forums.adobe.com/message/5735625#5735625. In the Actions box on the right, click the Stop Email Notifications link.
    Start a new discussion in Digital Publishing Suite at Adobe Community
    For more information about maintaining your forum email notifications please go to http://forums.adobe.com/message/2936746#2936746.

  • Putting frame with buttons into a thread

    please help!!!
    i've got a thread:
    package aJile;
    import java.io.*;
    import java.net.*;
    public class SocketHandler extends Thread
      private Socket socket;               // Socket used for messages 
      private int socketNr;
      private byte[] inbuf;
      private InputStream in;
      private OutputStream out;
      public SocketHandler(Socket socket)
        this.socket = socket; 
      public void send(String str) throws IOException {
           out.write(str.getBytes(), 0, str.length());
           out.flush();              
      public String receive() throws IOException {
           int numBytes = in.read(inbuf);
          String str = new String(inbuf, 0, numBytes);
          return str;
      public String switchOn() throws IOException {
           send("1");
           String state = receive();
           return state;
      public void run()
        try {
          // set up the input and output streams
          in  = socket.getInputStream();
          out = socket.getOutputStream();
          inbuf = new byte[128];
          receive();
         // System.out.println(switchOn());     
          in.close();
          out.close();
          socket.close();
          System.out.println("closing");
        catch (Exception e)
          System.out.println("Caught exception "+ e);
    }and i want to add a frame with buttons to this thread. that everytime tread starts, this frame would appear. and that methods of the thread would be called with a button press. How to join them?
    here is a frame:
    package buttons;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class Frame3 extends JFrame implements ActionListener
         JPanel pane = new JPanel(); 
         Icon lightIcon = new ImageIcon("light.gif");
         Icon darkIcon = new ImageIcon("dark.gif");
         JButton pressme = new JButton("Press Me");
         JButton ironButton = new JButton("Iron",lightIcon);
         JButton lampButton = new JButton("Lamp",lightIcon);
         JButton ovenButton = new JButton("Oven",lightIcon);
         public Frame3()  
              super("Event Handler Demo"); setBounds(100,100,300,200);
              setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              Container con = this.getContentPane(); // inherit main frame
              con.add(pane);
              pressme.setMnemonic('P');
              pressme.addActionListener(this);   // register button listener
              ironButton.addActionListener(this);
              lampButton.addActionListener(this);
              ovenButton.addActionListener(this);
              pane.add(ironButton);
              pane.add(lampButton);
              pane.add(ovenButton);
              pane.add(pressme);
      public void actionPerformed(ActionEvent event)
        Object source = event.getSource();
        if (source == pressme){     
          JOptionPane.showMessageDialog(null,"Hello!","Message Dialog",
          JOptionPane.PLAIN_MESSAGE);
        if (source == ironButton){
             if (ironButton.getIcon() == lightIcon){
                  ironButton.setIcon(darkIcon);               
             else ironButton.setIcon(lightIcon);
        if (source == lampButton){
             if (lampButton.getIcon() == lightIcon)
                  lampButton.setIcon(darkIcon);
             else lampButton.setIcon(lightIcon);
        if (source == ovenButton){
             if (ovenButton.getIcon() == lightIcon)
                  ovenButton.setIcon(darkIcon);
             else ovenButton.setIcon(lightIcon);
      public static void main(String[] args){
           Frame3 app = new Frame3();
           app.setVisible(true);
    }thank you

    could you tell me how to avoid exceptions?
    what i want to to is to call a method wich simply sends a string and gets a string back.
    public String switchOn() throws IOException {
           send("1");
           String state = receive();
           return state;
      }but when i call this method in actionPerformed() i get exceptios and my socket closes. It sends the string though, but after this program crashes. is there anything special to do if i want to use this Frame3 in order to communicate with a client by pressing buttons?

  • Top and bottom margins to be inside the frame and form should less cluster

    Hi All,
    In my application we have created nearly 10 regions and for each region i have created sub regions with No templates. Here are the deatils below.
    I need to display two regions side by side with borders, so what i have done is
    1. Created a region as #Region Start with No template with Display point as "Page template body (1. items below region content) and Header and footer i have
    given as <table border="1"><tr><td>
    2. Followed by region as #What with Wizard region as "Page template body(1. items below region content) and nothing given under header and fotter.
    3. Followed by reagion as #Region Middle with No template with Display point as "Page template body (1. items below region content) and Header and footer i
    have as </td><td>
    4. Followed by region as #where with Wizard region as "Page template body(1. items below region content) and nothing given under header and fotter.
    5. Folowed by region as #Region End with No template with Display point as "Page template body (1. items below region content) and Header and footer i have
    given as </td></tr><tr><td>
    Simiallry followed by rest of regions by creating dummy regions and placing the <tr> and <td> in Header and Footer.
    Now users are asking me to have insde the frame and form shoul dbe less cluster.
    Can suggestiosn on this who we need to achieve.
    Thanks,
    Anoo..

    'File' > 'Page Setup' is used to alter the page margins when you need to print the email. It is not used to create a Template email nor to change the overall theme used in the Thunderbird user interface.
    To add a theme to the overall Thunderbird window, you can choose
    * either a Windows theme via Control Panel > Personalization >Theme
    * or download a theme Add-on, there is a huge range here: https://addons.mozilla.org/en-US/thunderbird/themes/
    such as : https://addons.mozilla.org/en-US/thunderbird/addon/balloons/?src=ss
    If you are looking to create a Template email, then you open a new Write message, design the email, enter a Subject so that you can easily locate the email and click on 'File > Save as > Template or click on Save button and choose 'Template' from the options. then the email is saved in the Templates folder. To use, you click on Templates folder and double click on the email to open in a new Write message. then compose and send as normal. The original email will be saved in Templates folder for reuse.

  • Poster Frame and Trim Mode not working properly with post-synced clips

    Hi Everyone-
    Final Cut Pro seems to be doing something really odd and I'm wondering if anyone else has experienced it and if so what is the fix:
    We are shooting a movie on Red with sound coming in on multitrack wav files. We downconvert the R3D files to Prores and then manually sync the tracks in the timeline.
    We link the pix and sound and drag them to the bin to make our dailies. They all play, in sync. When we try to set a poster frame the issues begin. If I load the clip into the browser park the playhead on a frame and choose poster frame, the actual frame in the bin is very noticably offset (often by a few seconds).
    Also, when I use the trim mode, the frames jump to a different part of the shot during trim. It's like the shot is jumping ahead or back while I hit the frame advance or recede buttons. Once I let go of the button the image jumps to the correct number of frames. But, it's very distracting if I am trying to trim, for example, to just before an actor blinks. I can't trim 1 frame at a time. I have to keep hitting the button, watching the picture jump to a different part of the shot, release the trim button and watch the picture jump back to the now correctly trimmed frame...
    As a test I took some of the Prores clips with scratch track sound and brought them into the bin directly from the finder, bypassing the syncing. Using those clips, the trim and poster frames work as expected. Obviously something is going on during syncing.
    I assumed maybe because the audio and pix we different lengths the clip was getting "confused", and didn't know where to "start". So, in the timeline with the synced clips, I razor bladed a few shots, linked them, and dragged them to the bin so the audio and video were the exact same length... Same issue.
    I have noticed the same behavior on 2 separate Macs so I don't think its a preference or corrupted install issue.
    Anyone seen this and have any suggestions?
    Thanks,
    David

    Yes, David, I'm having the same problem under the same circumstances. we're using merged clips made from Prores QTs and multitrk BWF files. In the trim window, the display frame jumps ahead considerably in a frame-by-frame trim, but trims accurately in the timeline. My only work-around has been to use the left/right scrub arrows in the trim window when necessary, which displays the correct frame. Sorry not to have an answer, but I saw a post on another forum from 2007 that speculated it was an FCP 6 bug. Resetting prefs doesn't help.
    Tim

  • Adding Scrollbar and buttons to Dynamic Text

    Hello,
    I am trying to connect dynamic text to scrollbar and buttons. I did tutorial and Lynda.com and practically pasted the code in with my file names and for some reason it does not work. It says I have a "Access of Undefined Property mask_mc" Did I need to create a variable for this? I didn't in the tutorial.
    Right now I have the dynamic text loading successfuly in 2 different places and I wantd to add the scrollbar. I put the variables on frame 1 code and then I put the actually load code on the frame where it is needed.
    Any suggestions?
    Thanks! Sandra
    HERE IS CODE FOR FRAME 1:
    var textLoader:URLLoader = new URLLoader();
    var textReq:URLRequest;
    var scrollPercent:Number = 0;
    var minScroll:Number;
    var maxScroll:Number;
    var targetScroll:Number = philText_mc.y;
    var easing:Number = 5;
    var scrollAmt:Number = 15;
    var scrollDirection:Number = 0;
    HERE IS CODE FOR FRAME WHERE TEXT LOADS:
    textReq = new URLRequest("text_philosophy.txt");
    function philosophyTextLoaded(event:Event):void {
        philText_mc.philosophy_txt.text = textLoader.data;
        minScroll = philText_mc.y;
        maxScroll = minScroll - philText_mc.height + mask_mc.height;
    function dragScroller(event:MouseEvent):void
        var dragX:Number = line_mc.x - scroller_mc.width/2 + 1;
        var dragY:Number = line_mc.y;
        var dragW:Number = 0;
        var dragH:Number = line_mc.height - scroller_mc.height;
        scroller_mc.startDrag(false, new Rectangle(dragX,dragY,dragW,dragH));
        stage.addEventListener(MouseEvent.MOUSE_UP, stopDragging);
        stage.addEventListener(Event.ENTER_FRAME, setScrollPercent);
        stage.removeEventListener(Event.ENTER_FRAME, scrollText);
    function stopDragging(event:MouseEvent):void
        scroller_mc.stopDrag();
    function setScrollPercent(event:Event):void
        scrollPercent = (scroller_mc.y - line_mc.y) / (line_mc.height - scroller_mc.height);
        if(scrollPercent < 0)
            scrollPercent = 0;
        else if(scrollPercent > 1)
            scrollPercent = 1;
        targetScroll = (scrollPercent * (maxScroll - minScroll)) + minScroll;
        philText_mc.y -= (philText_mc.y - targetScroll) / easing;
    function scrollUp(event:MouseEvent):void
        setDirection(scrollAmt);
    function scrollDown(event:MouseEvent):void
        setDirection(-scrollAmt);
    function setDirection(dir:Number):void
        scrollDirection = dir;
        stage.addEventListener(Event.ENTER_FRAME, scrollText);
        stage.addEventListener(MouseEvent.MOUSE_UP, stopScrolling);
        stage.removeEventListener(Event.ENTER_FRAME, setScrollPercent);
    function scrollText(event:Event):void
        targetScroll += scrollDirection;
        philText_mc.y -= (philText_mc.y - targetScroll) / easing;
        if(philText_mc.y > minScroll)
            philText_mc.y = minScroll;
            targetScroll = minScroll;
        else if(philText_mc.y < maxScroll)
            philText_mc.y = maxScroll;
            targetScroll = maxScroll;
        scrollPercent = (philText_mc.y - minScroll) / (maxScroll - minScroll);
        scroller_mc.y = (scrollPercent * (line_mc.height - scroller_mc.height)) + line_mc.y;
    function stopScrolling(event:MouseEvent):void
        scrollDirection = 0;
    textLoader.load(textReq);
    scroller_mc.buttonMode = true;
    philText_mc.external_txt.autoSize = TextFieldAutoSize.LEFT;
    scroller_mc.addEventListener(MouseEvent.MOUSE_DOWN, dragScroller);
    textLoader.addEventListener(Event.COMPLETE, philosophyTextLoaded);
    up_btn.addEventListener(MouseEvent.MOUSE_DOWN, scrollUp);
    down_btn.addEventListener(MouseEvent.MOUSE_DOWN, scrollDown);

    Hello again,
    Maybe I am asking this question wrong. Instead of making you try and figure out what's going on in my file what I really need to know is how you would take this code I am attaching and make it happen on another frame besides frame 1 and it doesn't appear on frame 1. I think this may help me understand a little better.
    Also another way I was thinking to get around this would be to pull in an external swf into the spot where I want this text to go because I can make the scrollbars and external text work when it is the only thing going on in the movie. Would this be a bad way to set this up? and also SInce it is an external movie would I have maintimeline issues with mouse/scroller control?
    thanks! sandra
    Here is working code:
    var textLoader:URLLoader = new URLLoader();
    var textFile:URLRequest = new URLRequest("text/external.txt");
    var scrollPercent:Number = 0;
    var minScroll:Number;
    var maxScroll:Number;
    var targetScroll:Number = text_mc.y;
    var easing:Number = 5;
    var scrollAmt:Number = 15;
    var scrollDirection:Number = 0;
    function textLoaded(event:Event):void
        text_mc.external_txt.text = textLoader.data;
        minScroll = text_mc.y;
        maxScroll = minScroll - text_mc.height + mask_mc.height;
    function dragScroller(event:MouseEvent):void
        var dragX:Number = line_mc.x - scroller_mc.width/2 + 1;
        var dragY:Number = line_mc.y;
        var dragW:Number = 0;
        var dragH:Number = line_mc.height - scroller_mc.height;
        scroller_mc.startDrag(false, new Rectangle(dragX,dragY,dragW,dragH));
        stage.addEventListener(MouseEvent.MOUSE_UP, stopDragging);
        stage.addEventListener(Event.ENTER_FRAME, setScrollPercent);
        stage.removeEventListener(Event.ENTER_FRAME, scrollText);
    function stopDragging(event:MouseEvent):void
        scroller_mc.stopDrag();
    function setScrollPercent(event:Event):void
        scrollPercent = (scroller_mc.y - line_mc.y) / (line_mc.height - scroller_mc.height);
        if(scrollPercent < 0)
            scrollPercent = 0;
        else if(scrollPercent > 1)
            scrollPercent = 1;
        targetScroll = (scrollPercent * (maxScroll - minScroll)) + minScroll;
        text_mc.y -= (text_mc.y - targetScroll) / easing;
    function scrollUp(event:MouseEvent):void
        setDirection(scrollAmt);
    function scrollDown(event:MouseEvent):void
        setDirection(-scrollAmt);
    function setDirection(dir:Number):void
        scrollDirection = dir;
        stage.addEventListener(Event.ENTER_FRAME, scrollText);
        stage.addEventListener(MouseEvent.MOUSE_UP, stopScrolling);
        stage.removeEventListener(Event.ENTER_FRAME, setScrollPercent);
    function scrollText(event:Event):void
        targetScroll += scrollDirection;
        text_mc.y -= (text_mc.y - targetScroll) / easing;
        if(text_mc.y > minScroll)
            text_mc.y = minScroll;
            targetScroll = minScroll;
        else if(text_mc.y < maxScroll)
            text_mc.y = maxScroll;
            targetScroll = maxScroll;
        scrollPercent = (text_mc.y - minScroll) / (maxScroll - minScroll);
        scroller_mc.y = (scrollPercent * (line_mc.height - scroller_mc.height)) + line_mc.y;
    function stopScrolling(event:MouseEvent):void
        scrollDirection = 0;
    textLoader.load(textFile);
    scroller_mc.buttonMode = true;
    text_mc.external_txt.autoSize = TextFieldAutoSize.LEFT;
    scroller_mc.addEventListener(MouseEvent.MOUSE_DOWN, dragScroller);
    textLoader.addEventListener(Event.COMPLETE, textLoaded);
    up_btn.addEventListener(MouseEvent.MOUSE_DOWN, scrollUp);
    down_btn.addEventListener(MouseEvent.MOUSE_DOWN, scrollDown);

  • How to take input in one frame and display it in other frame of  same page?

    I need to take input (text) for the comment field in one of the frames and when submit button is pressed it should be displayed in the other frame on the same page.
    I am able to get the input from the user but its not reflected in the other frame which basically is a table...............so let me know if you guys have any suggestions
    I used following code
    <form name="input" action="<%= base_url %>/index.jsp?yr=<%= y %>&mon=<%= m %>&day=<%= d %>" method="post">
    Comment:
    <input type="text" name="comment" size="20"/>

    The trick is to define paintComponent to all applicable panels and pass the Graphics parameter to a separate method which does the drawing for you.
    class Component1 extends JPanel
       //blah blah blah - put your code here
       public void paintComponent(Graphics g)
          //insert setup functions here
          paintStuff(g);
       //more arbitary code
       public void paintStuff(Graphics g)
          //do your drawing here
    }And you would usually want to separate your UI components from the drawing so it doesn't intefere with the client's perception of the program. In other words, don't draw on the content pane, draw on a custom panel and add it to an appropriate part of the content pane.
    Stephen

  • Professional way to call that frame on button click?

    Hi
    Nice to get new look and feel for forum :)
    Wel my question is I have a frame which has many buttons textfields labels and other components too.
    On clicking one of the button I am opening a frame which is like calculator(display is same as calculator)
    I am using frame for that calculator.
    My question is that what will be the most professional way to call that frame on button click?
    All you java professionals your kind attention will be appreciated
    Regards

    Good question, I've often wondered this myself!
    Personally, I don't like to use anonymous inner classes for handling events. I generally handle events two ways:
    1. Make the main class implement lots of interfaces and use action commands. eg
    public class MyFrame extends JFrame implements ActionListener {
        public static final String CALC_BUTTON = "cb";
        public MyFrame() {
            super();
            JButton cButton = new JButton("Calculator");
            cButton.addActionListener(this);
            cButton.setActionCommand(CALC_BUTTON);
        public void actionPerformed(ActionEvent ae) {
             if (ae.getActionCommand().equals(CALC_BUTTON) {
                 //do something
    2. Subclass AbstractAction.
    public class MyAction extends AbstractAction {
        //create a constructor specific to the goal
        public MyAction(/*Some arguments*/) {
            //set  variables
        public void actionPerformed(ActionEvent ae) {
             //handle the action
    //and in the main class
    JButton cButton = new JButton("Calculator");
    cButton.setAction(new MyAction());I tend to use the first method more often, but if there's some specific kind of action, then I use the second method.
    I'm interested to know what other people do though. :)
    -Muel

  • Flash8 or Flash CS3 determine what frames and objects use a given library object

    I am doing cleanup on a FLA file(a large fla file). I am
    looking for an easy way to determine where each library item
    may be used in the given flash document and at what frame and
    layer it may be used at.
    Yes I have updated the use counts by selecting "update use
    counts". Which is really nice. Becuase I can then
    easily delete all the unneeded objects(note: I was also
    guaranteed they(library items) were not called into the FLA file
    dynamically by action script, Which was a relief).
    So what I am looking for is a way to run a report for one
    object or for the entire library to show me where
    a given symbol, button,swf, flv or picture is being used in
    the parent or it's chidren or in another library item.
    Here is an example of the report I am looking for.
    Library Item "logo.jpg":
    ocurrence #1> _root;layer8,frame 25
    ocurrence #2> _root;layer(showlogo),frame 25(imageframe)
    ocurrence #3> _root;layer(showfinishpage),frame
    125(exitpage)
    occurence #4> LIBRARYITEM(logoTween),frame23,layer2
    Does anyone know how this can be done...?
    Additional search item references
    ==============================
    report library items
    Flash 8 library report
    Flash MX library report
    Flash CS3 librarry report
    Flash Library objects usage counts
    Keep use counts updated
    update use counts now
    determine where library items are used in a give fla file
    flash library "update use counts" objects frames report
    flash "library use" objects frames report
    flash 8 fla library usage where are they being used

    Will Edit > Find and Replace help?
    I don't know of any report, other than Generate size report
    (found in publish settings under Flash), but you could probably
    write a .jsfl script to do it for you I imagine.

  • HELP: Preloader and Button AS3

    Hi guys!
    I used to work on AS2 to make my animations, buttons and portfolios, but now I needed to use AS3 to make some forms interact with some PHP script.
    TextInputs and Buttons on COMPONENTS are working and interacting normally with PHP. My PreLoader is working great too. But what should the easiest is not working: MY SIMPLE BUTTONS! It used to be so easy in AS1 and 2, but now on AS3 it's not working. I am putting all my action and codes in a ACTIONS FRAME in the top of my animation, but it is not working!
    I have my Preloader on my frame 1 working, calling my animation on frame 2. The code is here (it's working):
    stop();
    addEventListener(Event.ENTER_FRAME, loading);
    function loading(event:Event) {
    var bytestotal = stage.loaderInfo.bytesTotal;
    var bytesloaded = stage.loaderInfo.bytesLoaded;
    var sclbar = Math.round(bytesloaded*100/bytestotal);
    custom_animation.gotoAndPlay(sclbar);
    if (bytesloaded >= bytestotal) {
    removeEventListener(Event.ENTER_FRAME, loading);
    removeChild(custom_animation);
    gotoAndPlay(2);
    Then I placed my buttons actions on the frame 2.
    If I use the action:
    home_btn.addEventListener(MouseEvent.CLICK,clickHome);
    function clickHome(evt:MouseEvent):void {
    gotoAndPlay(2);}
    release_btn.addEventListener(MouseEvent.CLICK,clickRelease);
    function clickRelease(evt:MouseEvent):void {
    gotoAndPlay(2690);}
    My movie pauses and no action is added to my buttons.
    I get this error: TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at index_Scene1_fla::MainTimeline/frame2()
    If I use the action:
    addEventListener("addedToStage", oas);
    function oas(ev){
    init();
    home_btn.addEventListener(MouseEvent.CLICK,clickHome);
    function clickHome(evt:MouseEvent):void {
    gotoAndPlay(2);}
    release_btn.addEventListener(MouseEvent.CLICK,clickRelease);
    function clickRelease(evt:MouseEvent):void {
    gotoAndPlay(2690);}
    The movie plays complete, but I get no actions in buttons and a error in my components textinput and button (they look like shaking).
    I get this error: 1180: Call to a possibly undefined method init.
    I tried to use the import flash.display.SimpleButton too, but it doesn't work too.
    Anyone could help me????
    Thanks,
    Pedro

    If you can provide a clear explanation of where the buttons are and where the code for them is located that might help lead to a solution.  From what you have described already it is not clear where the code is and where the buttons are.  You should not have to use an init function if you are doing so to wait for the buttons to be loaded... they are already loaded when you get wherever they are.
    For the 1009 error, it is indicative of the object targeted by your code does not exist in theframe where that code is.  SO if you have your code on frame 1 and your buttons are in frame 2, that would account for that error, as well as a few other possible scenarios.

  • Gui labels and buttons not showing...

    I am using Java to create a gui and so far I have everything working.
    But there is a section of code thats not working out and Ill post the whole file here (not very big) to let you guys see whats going on. The issue lies in the action listner where I state "if a text feild is empty, display the option pane, else show the following" and its not showing the labels and buttons.
    Help?
    package student.information.search;
    import javax.swing.JFrame;
    import java.awt.GridBagLayout;
    import javax.swing.WindowConstants;
    import java.awt.Rectangle;
    import javax.swing.JLabel;
    import javax.swing.JOptionPane;
    import javax.swing.JPanel;
    import java.awt.ActiveEvent;
    import java.awt.Frame;
    import java.awt.GridBagConstraints;
    import java.awt.Insets;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import javax.swing.JTextField;
    import javax.swing.JButton;
    import student.information.readonly.ReadOnlyStudentForm;
    public class StudentSearch extends Frame implements ActionListener
       JTextField textField = new JTextField();
       JFrame frame = new JFrame();
       JPanel contentPane = (JPanel) frame.getContentPane();
       GridBagLayout gridBagLayout = new GridBagLayout();
        public StudentSearch()
            gridBagLayout.columnWidths = new int[]{20, 0, 12, 137, 17};
            gridBagLayout.rowHeights = new int[]{26, 0, 6, 0, 20};
            gridBagLayout.columnWeights = new double[]{1, 0, 0, 0, 0};
            gridBagLayout.rowWeights = new double[]{0, 0, 0, 0, 1};
            contentPane.setLayout(gridBagLayout);
            JButton button = new JButton();
            button.setText("Search");
            button.addActionListener(this);
            contentPane.add(button, new GridBagConstraints(3, 3, 1, 1, 0.0, 0.0, 13, 0, new Insets(0, 0, 0, 0), 0, 0));
            textField.setColumns(8);
            contentPane.add(textField, new GridBagConstraints(3, 1, 1, 1, 0.0, 0.0, 768, 2, new Insets(0, 0, 0, 0), 0, 0));
            JLabel label = new JLabel();
            label.setText("Student Seach");
            contentPane.add(label, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, 256, 0, new Insets(0, 0, 0, 0), 0, 0));
            frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
            frame.setTitle("Student Search");
            frame.setBounds(new Rectangle(500, 0, 500, 320));
            frame.setVisible(true);
       public void actionPerformed( ActionEvent arg0)
            if (textField.getText().equals(""))
              JOptionPane.showConfirmDialog(null, "Please enter a value in the search feild", "Error", JOptionPane.OK_CANCEL_OPTION); 
            else
               //Show the text fields here and the user information. 
                 *  While there are students for this search, change the text fields to Name, Last Name and ID and have a button called
                 *  View that when clicked allows for you to view all that students information.
                JLabel firstName = new JLabel();
                firstName.setText("Label");
                contentPane.add(firstName, new GridBagConstraints(5, 5, 1, 1, 0.0, 0.0, 768, 0, new Insets(0, 0, 0, 0), 0, 0));
                JLabel lastName = new JLabel();
                lastName.setText("Label");
                contentPane.add(lastName, new GridBagConstraints(3, 5, 1, 1, 0.0, 0.0, 256, 0, new Insets(0, 0, 0, 0), 0, 0));
                JLabel studentID = new JLabel();
                studentID.setText("Label");
                contentPane.add(studentID, new GridBagConstraints(1, 5, 1, 1, 0.0, 0.0, 256, 0, new Insets(0, 0, 0, 0), 0, 0));
                JButton viewStudentInformation = new JButton();
                viewStudentInformation.setText("Search");
                viewStudentInformation.addActionListener(new ActionListener()
                        public void actionPerformed(ActionEvent e)
                               //For viewing individual student information
                                new ReadOnlyStudentForm();
                contentPane.add(viewStudentInformation, new GridBagConstraints(7, 3, 1, 1, 0.0, 0.0, 13, 0, new Insets(0, 0, 0, 0), 0, 0));
    }

    In general when adding or removing components for a visible GUI you need to use:
    panel.add(...);
    panel.revalidate();
    panel.repaint();

Maybe you are looking for