Hiding a form card layout

Hey folks i have the code below, its an example that i have been messing around with.
I have a on the first card button 2 which has an action listener on, it simply opens another formwhich it does correct but i want the form with the card layout on it to be hidden.
As you can see from my code i have triediy numerous ways with no luck, hope i'm in the right forum and this shouldnt be in event handling
Any ideas welcomed
Ambrose
import java.awt.*;
import javax.swing.*;
import javax.swing.event.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class Tab_Demo implements ActionListener
     final static String ROUTER1 = "Router One";
     final static String ROUTER2 = "Router Two";
     final static String ROUTER3 = "Router Three";
     final static String ROUTER4 = "Router Four";
     final static String ROUTER5 = "Router Five";
     final static String ROUTER6 = "Router Six";
     private     JTable          table1;
     private     JTable          table2;
     private     JTable          table3;
     private     JTable          table4;
     private     JTable          table5;
           public JFrame frame;
     private Button b1 = new Button("Add");
     public void addComponentToPane(Container pane)
          JTabbedPane tabbedPane = new JTabbedPane(); //Create the "cards".           
          JPanel card1 = new JPanel()
     //Make the panel wider than it really needs, so //the window's wide enough for the tabs to stay //in one row.
     public Dimension getPreferredSize()
          Dimension size = super.getPreferredSize();
          size.width += 100;
          size.height += 600;
          return size;
          JButton button2 = new JButton("Button 2");
       button2.addActionListener(this);
       button2.setActionCommand("button2");
        card1.add(button2);
          card1.add(b1);
          card1.add(new JButton("But3"));
          card1.add(new JTextField("f",20));
          JPanel card2 = new JPanel();
          card2.add(new JButton("buttonDays"));
          // Create columns names
          String columnNames[] = { "IP Address ", "Address", "Private User", };
          // Create some data
          String dataValues[][] =
               { "IP1", "Dublin 1 Ireland", "Yes" },
               { "1P2", "Dublin 1 Ireland", "Yes" },
               { "IP3", "Dublin 1 Ireland", "Yes" },
               { "IP4", "Dublin 1 Ireland", "Yes" },
               { "IP5", "Dublin 1 Ireland", "Yes" }
          // Create a new table instance
          table2 = new JTable( dataValues, columnNames );
          card2.add(new JScrollPane(table2));
          JPanel card3 = new JPanel();
          JPanel card4 = new JPanel();
          JPanel card5 = new JPanel();
          JPanel card6 = new JPanel();
          tabbedPane.addTab(ROUTER1, card1);
          tabbedPane.addTab(ROUTER2, card2);
          tabbedPane.addTab(ROUTER3, card3);
          tabbedPane.addTab(ROUTER4, card4);
          tabbedPane.addTab(ROUTER5, card5);
          tabbedPane.addTab(ROUTER6, card6);
          pane.add(tabbedPane, BorderLayout.CENTER);
          b1.addActionListener(this);
          public void actionPerformed( ActionEvent e)
          if (e.getActionCommand().equals("button2"))
               Main_Menu fr = new Main_Menu("User Main Menu");
               //Test.setDefaultLookAndFeelDecorated(true);
               fr.show();
               //this.hide();
               //frame.setVisible(false);
          /** * Create the GUI and show it. For thread safety, *
          *this method should be invoked from the * event-dispatching thread. */
     private static void createAndShowGUI()
          //Make sure we have nice window decorations.
          //JFrame.setDefaultLookAndFeelDecorated(true);
          //Create and set up the window.
          JFrame frame = new JFrame("TabDemo");
          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          //Create and set up the content pane.
          Tab_Demo demo = new Tab_Demo();
          demo.addComponentToPane(frame.getContentPane());
          //Display the window.
          frame.pack();
          frame.setVisible(true);
     public static void main(String[] args)
          //Schedule a job for the event-dispatching thread:
          //creating and showing this application's GUI.
          javax.swing.SwingUtilities.invokeLater(new Runnable()
     public void run()
     createAndShowGUI();
}

HIDE_WINDOW does not hide a window that is associated to the main canvas of a form, same goes for HIDE_VIEW. And what do you mean by open_form?

Similar Messages

  • Hiding a form using card layout

    Hey folks i have the code below, its an example that i have been messing around with.
    I ahve a on the first card button 2 which has an action listener on, it simply opens another formwhich it does correct but i want the form with the card layout on it to be hidden.
    As you can see from my code i have triediy numerous ways with no luck, hope i'm in the right forum and this shouldnt be in event handling
    Any ideas welcomed
    Ambrose
    import java.awt.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    public class Tab_Demo implements ActionListener
         final static String ROUTER1 = "Router One";
         final static String ROUTER2 = "Router Two";
         final static String ROUTER3 = "Router Three";
         final static String ROUTER4 = "Router Four";
         final static String ROUTER5 = "Router Five";
         final static String ROUTER6 = "Router Six";
         private     JTable          table1;
         private     JTable          table2;
         private     JTable          table3;
         private     JTable          table4;
         private     JTable          table5;
               public JFrame frame;
         private Button b1 = new Button("Add");
         public void addComponentToPane(Container pane)
              JTabbedPane tabbedPane = new JTabbedPane(); //Create the "cards".           
              JPanel card1 = new JPanel()
         //Make the panel wider than it really needs, so //the window's wide enough for the tabs to stay //in one row.
         public Dimension getPreferredSize()
              Dimension size = super.getPreferredSize();
              size.width += 100;
              size.height += 600;
              return size;
              JButton button2 = new JButton("Button 2");
           button2.addActionListener(this);
           button2.setActionCommand("button2");
            card1.add(button2);
              card1.add(b1);
              card1.add(new JButton("But3"));
              card1.add(new JTextField("f",20));
              JPanel card2 = new JPanel();
              card2.add(new JButton("buttonDays"));
              // Create columns names
              String columnNames[] = { "IP Address ", "Address", "Private User", };
              // Create some data
              String dataValues[][] =
                   { "IP1", "Dublin 1 Ireland", "Yes" },
                   { "1P2", "Dublin 1 Ireland", "Yes" },
                   { "IP3", "Dublin 1 Ireland", "Yes" },
                   { "IP4", "Dublin 1 Ireland", "Yes" },
                   { "IP5", "Dublin 1 Ireland", "Yes" }
              // Create a new table instance
              table2 = new JTable( dataValues, columnNames );
              card2.add(new JScrollPane(table2));
              JPanel card3 = new JPanel();
              JPanel card4 = new JPanel();
              JPanel card5 = new JPanel();
              JPanel card6 = new JPanel();
              tabbedPane.addTab(ROUTER1, card1);
              tabbedPane.addTab(ROUTER2, card2);
              tabbedPane.addTab(ROUTER3, card3);
              tabbedPane.addTab(ROUTER4, card4);
              tabbedPane.addTab(ROUTER5, card5);
              tabbedPane.addTab(ROUTER6, card6);
              pane.add(tabbedPane, BorderLayout.CENTER);
              b1.addActionListener(this);
              public void actionPerformed( ActionEvent e)
              if (e.getActionCommand().equals("button2"))
                   Main_Menu fr = new Main_Menu("User Main Menu");
                   //Test.setDefaultLookAndFeelDecorated(true);
                   fr.show();
                   //this.hide();
                   //frame.setVisible(false);
              /** * Create the GUI and show it. For thread safety, *
              *this method should be invoked from the * event-dispatching thread. */
         private static void createAndShowGUI()
              //Make sure we have nice window decorations.
              //JFrame.setDefaultLookAndFeelDecorated(true);
              //Create and set up the window.
              JFrame frame = new JFrame("TabDemo");
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              //Create and set up the content pane.
              Tab_Demo demo = new Tab_Demo();
              demo.addComponentToPane(frame.getContentPane());
              //Display the window.
              frame.pack();
              frame.setVisible(true);
         public static void main(String[] args)
              //Schedule a job for the event-dispatching thread:
              //creating and showing this application's GUI.
              javax.swing.SwingUtilities.invokeLater(new Runnable()
         public void run()
         createAndShowGUI();
    }

    HIDE_WINDOW does not hide a window that is associated to the main canvas of a form, same goes for HIDE_VIEW. And what do you mean by open_form?

  • OTL: Time Card Layout Notification

    Hi all,
    I have 2 questions:
    1. How do I find out which Time Card Layout Notification we are using AND if that particular layout has been customized? Please answer both parts.
    2. How do I find out if a particular work flow has been customized? in this case its HXCEMP.
    Thank you all.
    OB

    OB,
    Check through the Preferences form to find the layout preference attached to a person.
    If your OTL implementer was wise enough, he would have given a new name to the modified layout. Otherwise use the fndload command to download the layout ldt file and compare with the original ones.
    --Shiv                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Adobe Forms:"No layout exists in original language"

    Hi All,
    when I try to activate the adobe form after designing the form in layout, getting an error "No layout exists in original  language EN", so please help out to resolve this issue.
    Thank you
    Lalitkumar.

    Check the language, translate the form, change the original language. Otto

  • Card layout trouble

    I cannot figure out why when I run the program it shows the second card, and will not change when I click on the buttons that should change the card.
    import java.io.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.text.*;
    import java.util.*;
    public class Payroll extends JFrame
        // Card Layout to hold panels of GUI
        private CardLayout cardLayout = new CardLayout();
        // panels for various parts of GUI
        private JPanel homePanel = new JPanel();
        private static JPanel filePanel = new JPanel();
        private JPanel processedPanel = new JPanel();
        private JPanel journalPanel = new JPanel();
        private JPanel checkPanel = new JPanel();
        private JPanel stubPanel = new JPanel();
        // contentPane will hold other panels via cardLayout
        private JPanel contentPane;
        //row panels that will be used in various other panels
        private JPanel firstRow = new JPanel();
        private JPanel secondRow = new JPanel();
        private JPanel thirdRow = new JPanel();
        private JPanel fourthRow = new JPanel();
        private JPanel fifthRow = new JPanel();
        //create other data
        private int fileReturnValue;
        private JFileChooser fc = new JFileChooser();
        private File file;
        public Payroll()
            super("Widget Incorporated Payroll");
            contentPane = (JPanel)getContentPane(); // get contentpane
            contentPane.setLayout(cardLayout);  //set its layout to cardlayout
            //create the panels as cards
            homePanel = createHomePanel();
            filePanel = createFilePanel();
            /*processedPanel = createProcessedPanel();
            journalPanel = createJournalPanel();
            checkPanel = createCheckPanel();
            stubPanel = createStubPanel();*/
            contentPane.add(homePanel,"home");
            contentPane.add(filePanel,"file");
            /*contentPane.add(processedPanel);
            contentPane.add(journalPanel);
            contentPane.add(checkPanel);
            contentPane.add(stubPanel);*/
            cardLayout.show(contentPane, "home");
        private JPanel createHomePanel()
            //Create the layout for this panel
            JPanel homePanel = new JPanel(new GridLayout(4,1));
            FlowLayout rowSetup = new FlowLayout(FlowLayout.CENTER);
                firstRow.setLayout(rowSetup);
                secondRow.setLayout(rowSetup);
                thirdRow.setLayout(rowSetup);
            //Create components for this panel
            JLabel hoursWorkedLabel = new JLabel("Default hours worked:");
            JTextField hoursWorkedField = new JTextField("40",2);   
            JButton processButton = new JButton ("Process payroll for all non-terminated employees");  
            JButton closeButton = new JButton ("End Program");
            //Clear all rows
            firstRow.removeAll();
            secondRow.removeAll();
            thirdRow.removeAll();
            fourthRow.removeAll();
            fifthRow.removeAll();
            //Add the components to rows
            firstRow.add(hoursWorkedLabel);
            firstRow.add(hoursWorkedField);
            secondRow.add(processButton);
            thirdRow.add(closeButton);
            //Add the rows to this panel
            homePanel.add(firstRow);
            homePanel.add(secondRow);
            homePanel.add(thirdRow);
            //Add action listeners to the buttons
            processButton.addActionListener(new ActionListener()
                public void actionPerformed(ActionEvent e)
                    //creates next part of GUI
                    cardLayout.show(contentPane,"file");
            processButton.addActionListener(new ActionListener()
                public void actionPerformed(ActionEvent e)
                    //Verfies user wants to close program
                    int answer = JOptionPane.showConfirmDialog(null,"Are you sure you want to end the program","Exit",JOptionPane.YES_NO_OPTION);
                    if (answer == JOptionPane.YES_OPTION)
                    System.exit(0);
            return homePanel;
        private JPanel createFilePanel()
            //Create the layout for this panel
            JPanel filePanel = new JPanel(new GridLayout(3,1));
            FlowLayout rowSetup = new FlowLayout(FlowLayout.CENTER);
                firstRow.setLayout(rowSetup);
                secondRow.setLayout(rowSetup);
                thirdRow.setLayout(rowSetup);
            //Create components for this panel
            JLabel chooseFileLabel = new JLabel("Select the payroll file");
            final JTextField fileChooseField = new JTextField(25);
            JButton fileChooseButton = new JButton("Find");
            JButton fileOKButton = new JButton("Process");
            JButton fileBackButton = new JButton ("Back");
            //Clear all rows
            firstRow.removeAll();
            secondRow.removeAll();
            thirdRow.removeAll();
            fourthRow.removeAll();
            fifthRow.removeAll();
            //Add the components to rows
            firstRow.add(chooseFileLabel);
            secondRow.add(fileChooseField);
            secondRow.add(fileChooseButton);
            thirdRow.add(fileBackButton);
            thirdRow.add(fileOKButton);
            //Add the rows to this panel
            homePanel.add(firstRow);
            homePanel.add(secondRow);
            homePanel.add(thirdRow);
            //Add action listeners to the buttons
            fileChooseButton.addActionListener(new ActionListener()
                public void actionPerformed(ActionEvent e)
                    //Goes back to previous part of GUI
                    chooseFile(fileChooseField);
            fileBackButton.addActionListener(new ActionListener()
                public void actionPerformed(ActionEvent e)
                    //Goes back to previous part of GUI
                    cardLayout.show(contentPane,"home");
            return filePanel;
        private void chooseFile(JTextField field)
            fileReturnValue = fc.showOpenDialog(filePanel);
            if (fileReturnValue == JFileChooser.APPROVE_OPTION)
                file = fc.getSelectedFile();
            field.setText(file.toString());
        public static void main(String[] args)
            java.awt.EventQueue.invokeLater(new Runnable()
                public void run()
                    Payroll frame = new Payroll();
                    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                    frame.pack();
                    frame.setLocationRelativeTo(null);
                    frame.setVisible(true);           
        }

    I used an example from Encephtalophathic as a guide
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class SimpleCardLO1 extends JFrame
        // first create a CardLayout object
        private CardLayout cardlayout = new CardLayout();
        // contentPane will hold the next two panels via CardLayout
        private JPanel contentPane;
        private JPanel firstPanel;
        private JPanel nextPanel;
        public SimpleCardLO1()
            super("Simple Card Layout");
            contentPane = (JPanel)getContentPane(); // get contentpane
            contentPane.setPreferredSize(new Dimension(160, 80));
            contentPane.setLayout(cardlayout); //set its layout to cardlayout
            // create the two panels held in contentPane as cards
            firstPanel = createFirstPanel();
            nextPanel = createProcessPanel();
            // and add them.  The String helps to recognize which panel is which
            contentPane.add(firstPanel, "First");
            contentPane.add(nextPanel, "Next");
        private JPanel createFirstPanel()
            JPanel firstPanel = new JPanel(new GridLayout(0, 1, 20, 20));
            JPanel buttonPanel = new JPanel();
            JButton nextButton = new JButton("Process");
            buttonPanel.add(nextButton);
            firstPanel.add(buttonPanel);
            nextButton.addActionListener(new ActionListener()
                public void actionPerformed(ActionEvent e)
                    // to get the next panel, simply call cardlayout's next method
                    // also pass a reference the component that is using the cardlayout as its manager
                    cardlayout.next(contentPane);
            return firstPanel;
        private JPanel createProcessPanel()
            JPanel processPanel = new JPanel(new GridLayout(0, 1, 20, 20));
            JPanel buttonPanel = new JPanel();
            JButton backButton = new JButton("Back");
            buttonPanel.add(backButton);
            processPanel.add(buttonPanel);
            backButton.addActionListener(new ActionListener()
                public void actionPerformed(ActionEvent e)
                    // to get the previous panel, call the previous method
                    cardlayout.previous(contentPane);
            return processPanel;
        // code to call this program in a thread-safe way
        public static void main(String[] args)
            java.awt.EventQueue.invokeLater(new Runnable()
                public void run()
                    SimpleCardLO1 frame = new SimpleCardLO1();
                    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                    frame.pack();
                    frame.setLocationRelativeTo(null);
                    frame.setVisible(true);            }
    }The example works and mine doesn't and I just can't find the difference
    Edited by: tim.raptorrunner on Jan 17, 2008 8:54 PM
    As far as I can tell it decided to randomly work.

  • IPhoto card layout

    I have iPhoto ver 9.4.3. I am trying to create a flat card but iphoto only alows me to use 4 different card layouts.
    Is there a way to modify the "standard" layouts or create new card layouts other than what iPhoto allows?

    Do you have iWork?  With Pages it's easy to create a collage of photos of any size you want. Just drag the photos from iPhoto onto the Pages layout, resize and place where you want Like this 20 x 30 poster with 96 photos:
    The demo version of OmniGraffle will let you create a layout with 10 photos on it.

  • Importing form field layout from one form to another ?

    I often create forms in both English and French. Many are long and complicated and I have to create them all individually. Is there any way I could use the form field layout from one form, for another form? That would be fantastic.

    Sure. To replace the underlying page contents and retain any fields, document-level code, links, etc., select: Document > Replace Pages
    you will likely have some tweaking to do to some field positions.

  • HT1918 I am trying to change my credit card number, due to loss of former card.

    I am trying to change my credit card number, due to loss of former card. itunes is declining my new card as invalid. do i need to create a new appID?

    no dont create a new apple id.  that will only make more issues.
    see this article
    http://support.apple.com/kb/HT1918
    Peace, Clyde

  • Card Layout

    I want to chage this so that when the user clicks the continueButton I want the two radio buttons to be replaced with secondCategoryCheckBox and some other things. I've been trying to learn card layout from the web but no success. If you know will you take a few seconds to edit my code so I can understand card layout . thanks
    import java.awt.*;
    import javax.swing.*;
    import java.awt.event.*;
    import javax.swing.border.*;
    import java.lang.System;
    public class MainPanel extends JFrame implements ActionListener
    private final int ITEM_PLAIN = 0; // Item types
    private final int ITEM_CHECK = 1;
    private final int ITEM_RADIO = 2;
    private JPanel topPanel;
    private JPanel newItemPanel;
    private JRadioButton tigerRadio;
    private JRadioButton bearRadio;
    private ButtonGroup bg;
    private JButton continueButton;
    private JLabel blankLabel; //used to give space between things
    private JPanel newItemDescriptionPanel;
    private JCheckBox secondCategoryCheckBox;
    private JMenuBar menuBar;
    private JMenu menuFile;
    private JMenu menuEdit;
    private JMenu menuProperty;
    private JMenuItem menuPropertySystem;
    private JMenuItem menuPropertyEditor;
    private JMenuItem menuPropertyDisplay;
    private JMenu menuFileNew;
    private JMenuItem menuFileNewAccount;
    private JMenuItem menuFileNewItem;
    private JMenuItem menuFileOpen;
    private JMenuItem menuFileSave;
    private JMenuItem menuFileSaveAs;
    private JMenuItem menuFileExit;
    private JMenuItem menuEditCopy;
    private JMenuItem menuEditCut;
    private JMenuItem menuEditPaste;
    public MainPanel()
    setTitle( "Ebay Organizer" );
    setSize( 310, 130 );
    topPanel = new JPanel();
    topPanel.setLayout( new BorderLayout() );
    topPanel.setBorder (BorderFactory.createTitledBorder ("TopPanel"));
    //topPanel.setPreferredSize(new Dimension (300,300));
    getContentPane().add( topPanel );
    // For New Item Panel
    ButtonListener ears = new ButtonListener();
    blankLabel = new JLabel (" "); // used to give space between radio buttons and continue button
    continueButton = new JButton ("Continue >");
    continueButton.addActionListener (ears);
    newItemPanel = new JPanel();
    newItemPanel.setLayout (new BoxLayout(newItemPanel, BoxLayout.Y_AXIS));
    topPanel.add (newItemPanel, BorderLayout.NORTH);
    newItemPanel.setBorder (BorderFactory.createTitledBorder ("NewItemPanel"));
    newItemPanel.setVisible (false);
    tigerRadio = new JRadioButton ("Tiger" );
    bearRadio = new JRadioButton ("Bear");
    bg = new ButtonGroup();
    bg.add(tigerRadio);
    bg.add(bearRadio);
    tigerRadio.addActionListener (ears);
    bearRadio.addActionListener (ears);
    newItemPanel.add (tigerRadio);
    newItemPanel.add (bearRadio);
    newItemPanel.add (blankLabel);
    newItemPanel.add (continueButton);
    // ------ After continue pressed ---------
    newItemDescriptionPanel = new JPanel();
    newItemDescriptionPanel.setLayout (new BoxLayout(newItemDescriptionPanel, BoxLayout.Y_AXIS));
    newItemPanel.add (newItemDescriptionPanel, BorderLayout.NORTH);
    newItemDescriptionPanel.setBorder (BorderFactory.createTitledBorder ("newItemDescriptionPanel"));
    secondCategoryCheckBox = new JCheckBox ("second category animal");
    newItemDescriptionPanel.add (secondCategoryCheckBox);
    newItemDescriptionPanel.setVisible (false);
    // Create the menu bar
    menuBar = new JMenuBar();
    // Set this instance as the application's menu bar
    setJMenuBar( menuBar );
    // Build the property sub-menu
    menuProperty = new JMenu( "Properties" );
    menuProperty.setMnemonic( 'P' );
    // Create property items
    menuPropertySystem = CreateMenuItem( menuProperty, ITEM_PLAIN,
    "System...", null, 'S', null );
    menuPropertyEditor = CreateMenuItem( menuProperty, ITEM_PLAIN,
    "Editor...", null, 'E', null );
    menuPropertyDisplay = CreateMenuItem( menuProperty, ITEM_PLAIN,
    "Display...", null, 'D', null );
    //Build the File-New sub-menu
    menuFileNew = new JMenu ("New");
    menuFileNew.setMnemonic ('N');
    //Create File-New items
    menuFileNewItem = CreateMenuItem( menuFileNew, ITEM_PLAIN,
    "Item", null, 'A', null );
    menuFileNewAccount = CreateMenuItem( menuFileNew, ITEM_PLAIN,
    "Account", null, 'A', null );
    // Create the file menu
    menuFile = new JMenu( "File" );
    menuFile.setMnemonic( 'F' );
    menuBar.add( menuFile );
    //Add the File-New menu
    menuFile.add( menuFileNew );
    // Create the file menu
    // Build a file menu items
    menuFileOpen = CreateMenuItem( menuFile, ITEM_PLAIN, "Open...",
    new ImageIcon( "open.gif" ), 'O',
    "Open a new file" );
    menuFileSave = CreateMenuItem( menuFile, ITEM_PLAIN, "Save",
    new ImageIcon( "save.gif" ), 'S',
    " Save this file" );
    menuFileSaveAs = CreateMenuItem( menuFile, ITEM_PLAIN,
    "Save As...", null, 'A',
    "Save this data to a new file" );
    // Add the property menu
    menuFile.addSeparator();
    menuFile.add( menuProperty );
    menuFile.addSeparator();
    menuFileExit = CreateMenuItem( menuFile, ITEM_PLAIN,
    "Exit", null, 'X',
    "Exit the program" );
    //menuFileExit.addActionListener(this);
    // Create the file menu
    menuEdit = new JMenu( "Edit" );
    menuEdit.setMnemonic( 'E' );
    menuBar.add( menuEdit );
    // Create edit menu options
    menuEditCut = CreateMenuItem( menuEdit, ITEM_PLAIN,
    "Cut", null, 'T',
    "Cut data to the clipboard" );
    menuEditCopy = CreateMenuItem( menuEdit, ITEM_PLAIN,
    "Copy", null, 'C',
    "Copy data to the clipboard" );
    menuEditPaste = CreateMenuItem( menuEdit, ITEM_PLAIN,
    "Paste", null, 'P',
    "Paste data from the clipboard" );
    public JMenuItem CreateMenuItem( JMenu menu, int iType, String sText,
    ImageIcon image, int acceleratorKey,
    String sToolTip )
    // Create the item
    JMenuItem menuItem;
    switch( iType )
    case ITEM_RADIO:
    menuItem = new JRadioButtonMenuItem();
    break;
    case ITEM_CHECK:
    menuItem = new JCheckBoxMenuItem();
    break;
    default:
    menuItem = new JMenuItem();
    break;
    // Add the item test
    menuItem.setText( sText );
    // Add the optional icon
    if( image != null )
    menuItem.setIcon( image );
    // Add the accelerator key
    if( acceleratorKey > 0 )
    menuItem.setMnemonic( acceleratorKey );
    // Add the optional tool tip text
    if( sToolTip != null )
    menuItem.setToolTipText( sToolTip );
    // Add an action handler to this menu item
    menuItem.addActionListener( this );
    menu.add( menuItem );
    return menuItem;
    public void actionPerformed( ActionEvent event )
    if (event.getSource() == menuFileExit)
    System.exit(0);
    if (event.getSource() == menuFileNewAccount)
    System.out.println ("hlkadflkajfalkdjfalksfj");
    if (event.getSource() == menuFileNewItem){
    newItemPanel.setVisible (true);
    //System.out.println( event );
    private class ButtonListener implements ActionListener
    public void actionPerformed(ActionEvent event)
    if (event.getSource() == continueButton){
    if (!(tigerRadio.isSelected()) && !(bearRadio.isSelected()))
    JOptionPane.showMessageDialog(null, "You must select at least one.", "Error", JOptionPane.ERROR_MESSAGE);
    else{
    if (tigerRadio.isSelected()){
    //newItemPanel.setVisible (false);
    newItemDescriptionPanel.setVisible (true);
    }

    have you used a JTabbedPane?
    a cardlayout is just a JTabbedPane, but without tabs.
    search the swing forum for
    "new CardLayout"
    and you will find plenty of working examples

  • How do determine shown card in card layout

    Hi, each of my cards is an extended JPanel. I have to run some code, but the code thats needs to be run is dependent on which extended JPanel is currently shown in my card layout (because the code to be run is part of the extended JPanel). So, is there an easy way to get the object that the currenly displayed card is so that I can call methods on that object (one of the extended JPanels)?
    Since the card layout is just the layout of a JPanel anyway, I thought I might just try to call the methods on that panel. But since that is just a normal panel, it doesn't know about the methods I need to call. And I'm not sure if I could just cast it (but even if I could, I wouldn't know what to cast it to because I dont know which cards is currently displayed, and hence which type of extended JPanel to cast it to)
    Thanks in advance,
    -Marshall

    There are different ways to do this. One of the easiest is to keep track of the index of the card that is showing and use this to access the reference to the component you put on that card. You can track the index in your event code.

  • Card layout pb(URGENT)

    Wrote a Java application about pollen and I want to display an HTML file in the very begining. then when I click on it I go to another page in which I select some family types etc...
    then click on next and get the results. from the results page I can click on previous and I'm supposed to go back to the page where I can select family types. I used a card layout.
    here's the program :
    editor where I put the html file
    selection is the page where i can select families
    result is the results page...
    this is not the full program, just a small part...
    principal = new JPanel();
    principal.setLayout(card);
    selection = new JPanel();
    principal.add(selection, "1");
    card.show(principal, "1");
    page = new JPanel();
    page.setLayout(card);
    editor = new JEditorPane();
    editor.setEditable(false);
    page1 = new JPanel();
    page1.setLayout(new BorderLayout());
    page1.add(principal, "Center");
    page.add("1", editor);
    page.add("2", page1);
    card.show(page, "1");
    //if I clich on the html page, go to the search page
    editor.addMouseListener(new MouseAdapter()
    public void mouseClicked(MouseEvent evt)
    System.out.println("click");
    card.show(page, "2");
    getContentPane().add(page, "Center");
    //button bChercher is a button put in the south of page1
    bChercher.addActionListener(new java.awt.event.ActionListener()
    public void actionPerformed(ActionEvent e)
    System.out.println("click");
    //principal.add(selection, "1");
    card.show(principal, "1");
    bChercher.setEnabled(false);
    bInit.setEnabled(true);
    bResult.setEnabled(true);
    repaint();
    the problem is, whenever I click on the button bChercher, it sends me back to editor and not selection... it does work though id I add selection again in principal, but it's too slow...
    thanx!

    Sorry... stupid question... :o)

  • Looking to learn business card layout

    looking to learn business card layout.  is there a tutorial?

    Hello Jumpshotz
    Here is a link
    http://tv.adobe.com/watch/make-it-with-creative-cloud/creating-your-business-card/
    Try using Adobe TV, it is a great resource with excellent tutorials.
    TREX

  • Additional Form Guide Layout

    Hello,
    Does any one know if there are any additional Form Guide Layout beside Cobalt Bar, Cobalt Standard, Cobalt Tree, or Workspace that is available to download for LC Designer 8.2.1 with SP3.
    Thanks,
    Han Dao

    Hi,
    Please check the field catalog population.
    There could be some place where the field catalog attribute wa_fieldcat-no_out = 'X' is set.
    Probably the fields that you have added might be present in another internal table too and these two internal tables could probably use the same subroutine for field catalog population.

  • Master with many details form best layout

    Hi,
    I have one master table, and 5 detail tables.
    I need to build a form (or more) to maintain these tables .
    What is the best layout for this form ? should I use tab pages (generally not friendly) ? should I use separate forms ?
    Any best practices? Any samples available?
    Thanks in advance
    AK

    What other options do you expect?
    1. 5 detailed tables - each updated on a single page
    2. 5 detailed tables - all updated on one page
    Denes Kubicek
    http://deneskubicek.blogspot.com/
    http://www.opal-consulting.de/training
    http://apex.oracle.com/pls/otn/f?p=31517:1
    -------------------------------------------------------------------

  • Models Comp Card Layout

    Yes I am new to Photoshop.  Perhaps these might be dumb questions.  If you are easily offended by questions of a "rookie nature" please feel free the stop reading now and save yourself the aggravation.  If you are forging ahead, "Thank You So Much!"
    I am attempting to make a Model's Comp Card.  The layout size is 8.5 X 5.5.  One picture on the front and two on the back.  Although I have a template to plug the pictures into, I find that the pictures are not fitting into the slots properly.  When I attempt to resize them I find that the proportions are off (too wide, too tall for the space) -------------This is problem #1
    So now I am going to discard the template and just plug the pictures into a clean, new white background in Photoshop CC.  I open a new file and change the page orientation to horizontal.
    And is it possible to have the page orientation horizontal while keeping the imported pictures vertical?  Can these two functions be separate?
    How can I be sure that the actual size of the page will be 8.5 X 5.5 when it is printed out?
    FYI I am using Photoshop CC and I am on a PC.
    Thanks
    ohhhhhhhhhh! I GET how to make sure paper size is 8.5 X 5.5. I just figured that one out!
    Message was edited by: Deidre Owens
    Message was edited by: Deidre Owens

    I am glad you figured out page sizes. However since this for beginners, we must try to include answers to all questions to other new users will learn.
    When starting out there are two ways to get your document size. The first is the new document, File>New then in the new dialog box you pick what medium you will be designing for such as the web, print, video and so on.
    Then you can either pick from a preset size or type in the height, width and resolution in the appropriate boxes - The height and width values can be pixels, inches, centimeters, and I think pica's. (don't recall sorry) The ppi or resolution value is only important for print when you are using a physical size for width and height. The two together determine the pixel dimensions. Otherwise typing in pixel values, you can ignore the ppi unless you will be printing. The pixel values divided by the ppi will tell you what the physical print size will be.
    ex.
    inches x ppi = pixels
    pixels / ppi = inches
    OK, that's the first way. You can also get the document size from a document. File>Open the document window will now have the same size as the image you loaded.
    Now lets deal with wrong ratio.
    A ratio is the width to height values - If both width and height are same, this is a square ratio or 1:1
    That is as detailed as I will get for now, as it can get overly complicated and out of scope for this thread, plus it pushes my comfort level a bit. (don't tell any one)
    OK, If the image is too wide for your use or too high, it could be said the ratio is not correct as it does not match your needs.
    So you have two options, you can scale an image, which may be needed anyways just to get one side to match. Make sure when you scale an image you hold down the shift key to constrain the scaling otherwise you will distort your image.
    To scale an image-
    Select the layer the image is on in the layers panel
    Now on the keyboard press ctrl-t for windows or cmd-t on a mac. This will put you in transform mode.
    Place the cursor over a small square in one of the four corners of your image. You will see the cursor change shape.
    Hold down your mouse button and the shift key then drag away from the image to scale up or drag towards the image to scale down.
    When you are satisfied you can press the enter or return key on the keyboard or press the large checkmark in the top tool bar.
    To rotate an image you would take the same steps however you would place the cursor outside one of the four corners and drag sideways.
    Ok, lets say one side fits and the other side is still too large - By the way that would be preferable than having one side too small, it is easier to remove data than to add it.
    At this point to remove data to make the other side smaller, you would use the crop tool found in the toolbar on the left side. You can either type in the size you need in the top tool bar or drag the crop tool across the image until it is the right size. Finally you could just leave the default crop as is then move each side inward until it fits size you want. Basically there is three ways to use the crop tool and it is up to you to decide what works best for you.
    Note: The crop tool affects the entire document. - You can save this image after it is cropped then place this file into another document.
    Another option is that you could use the rectangle selection tool and drag out the size you need or type in the top tool bar. Then Select Layer>Layer Mask>Reveal Selection. This will create a mask based on the selection you made and hide anything out side of that selection for that layer. (This is layer based where as crop is document based)
    A hidden tip: You can drag the crop tool outward to add canvas space.
    And finally vertical vs horizontal images vs the canvas.
    The document can be either horizontal or vertical by reversing the height and the width in the new dialog box, by changing the two values in the Image>Image Size dialog box, by adding space to the canvas in the Image>Canvas Size dialog box, or by using the crop tool.
    Whereas the image is layer based so transforms to the rescue. Same as scaling.  Don't forget to look at the top tool bar, those values can be handy. You can right click to choose a different dimension type. (You can also type in the dimension ex. let say it is in percentages and you want inches just type the value and the abbreviation like this 2in or 45px)
    Remember masks that is the layer based version of cropping.
    Good luck and any more questions ask...

Maybe you are looking for

  • Search For business transactions

    Hi All Please help on this when we  do crmd_order and go to the search for business transaction screen there is a find tab in which we get all transaction types- I want to hide some of the transaction types from there Gor eg- the transaction types ar

  • Screen looks normanl; Printing gibberish

    When I print messages from Earthlink.webmail they come out partially garbled in Firefox (not a problem if I use Internet Explorer. I don't think it's the printer, because it doesn't matter if I send it to a different printer.

  • Deleting images from bridge

    I used to be able to right click on an image in bridge and delete it. That option seems to be gone. Has it moved? Am I missing it somehow?

  • Documents.GetByKey returns an invalid document

    I have come across a really weird DI API problem, which seems to be related to some databases, but not specifically to any specific version of SBO or DI API. I have reproduced the problem on both SBO 6.5 and 2004. With some databases, especially the

  • OpenSSO Multiple Authentication Attributes

    Using OpenSSO 8u2p3 Build 6 and Sun DS 7 on Red Hat. Using LDAP Auth Service. I would like to let users choose from 2 different att values as their login i.e. uid or badge number; UID is the RDN of all user DNs. I go to Authentication | Module Instan