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)

Similar Messages

  • 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?

  • 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?

  • 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.

  • 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                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • 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.

  • 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

  • How to authenticate card reader? (urgent !!!)

    hallo everybody,
    we are working on java cards.......But we are aware from establishing secure session in between card reader and card.....
    the things which we knows are 1) when card authenticates the card reader it is "External Auth"
    2) when card reader authenticates the card it is "Enternal Auth."
    please can anyone help me how it takes place? and the what is the actual mechanism takes place
    while authentication?
    * Which keys are used?
    *How computation takes place?
    Any regarding information is invitable.....
    please....Its urgent!

    This is covered in detail in the Global Platform Secure Channel Protocol 01 specifications.
    1. application issues an INIT_UPDATE specifying which keyset to use
    2. Card returns card-cryptogram
    3. application calculates a card-cryptogram to match the card card-cryptogram using shared secret(keyset)
    4. application issues an EX_AUTH with MAC'd data

  • 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...

  • Card Layout Issues

    Can someone tell me why is it when I click on the table row for the card to appear, it doesn't appear until I resize the window. Even if I maximize the window prior to clicking the table row to show the card, it still doesn't appear.
    import java.awt.event.*;
    import java.awt.*;
    import com.sun.java.swing.*;
    import com.sun.java.swing.border.*;
    public class TableFrame extends JFrame implements MouseListener
    private JPanel tablePanel;
    private JPanel cardPanel;
    private JTable mainTable;
    private JTable cardTable;
    private CardLayout layout;
    private JScrollPane mainTableScrollPane;
    private JScrollPane cardTableScrollPane;
    private MainTable mt;
    private Cards cards;
    public TableFrame()
    tablePanel = new JPanel();
    cardPanel = new JPanel();
    layout = new CardLayout();
    mainTable = new JTable();
    cardTable = new JTable();
    mt = new MainTable();
    cards = new Cards();
    createAndShowGUI();
    public void addComponentsToPane(Container pane)
    pane.setLayout(new GridBagLayout());
    GridBagConstraints constraints = new GridBagConstraints();
    constraints.fill = GridBagConstraints.HORIZONTAL;
    mainTable = new JTable(mt);
    cardTable = new JTable(cards);
    mainTable.addMouseListener(this);
    tablePanel = addTablePanel();
    constraints.gridx = 0;
    constraints.gridy = 0;
    constraints.gridheight = 1;
    constraints.gridwidth = 3;
    pane.add(tablePanel);
    cardPanel = addCardPanel();
    constraints.gridx = 0;
    constraints.gridy = 4;
    constraints.gridheight = 1;
    constraints.gridwidth = 2;
    pane.add(cardPanel);
    private JPanel addTablePanel()
    tablePanel = new JPanel();
    mainTableScrollPane = new JScrollPane(mainTable);
    tablePanel.add(mainTableScrollPane);
    return tablePanel;
    private JPanel addCardPanel()
    cardPanel = new JPanel();
    cardPanel.setLayout(layout);
    cardPanel.add(cardTable, "1");
    cardTableScrollPane = new JScrollPane(cardTable);
    cardPanel.add(cardTableScrollPane, "1");
    return cardPanel;
    private void createAndShowGUI()
    JFrame frame = new JFrame("Test Frame");
    frame.setResizable(true);
    addComponentsToPane(frame.getContentPane());
    cardPanel.setVisible(false);
    frame.setSize(700, 700);
    frame.setVisible(true);
    public void mousePressed(MouseEvent evt)
    int rowSelected = 0;
    int columnSelected = 0;
    Object value = null;
    rowSelected = mainTable.getSelectedRow();
    columnSelected = mainTable.getSelectedColumn();
    System.out.println("\n" + "Cell selected at row " + rowSelected + " and column " +
    columnSelected);
    value = mainTable.getValueAt(rowSelected, columnSelected);
    System.out.println("The value in that cell is: " + value);
    cardPanel.setVisible(true);
    System.out.println("I'm Here A");
    layout.show(cardPanel, "1");
    }

    A very very old version. I work for the government on
    a long-standing contract and we're using HP-UX 10.2.
    In order to upgrade to from 1.1.8 to Java 2, we would
    have to upgrade to HP-UX 11.0. As of now the
    government isn't willing to fund that operation.My Condolences!

  • Photo card layouts

    We like to design our own cards but find the layouts that come with Photoshop 8. essential limited.  We don't want to publish through the internet.  Is there a site where we can import layouts, etc. into photoshop?
    thanks
    tim

    You can obtain templates, free, from Avery(www.avery.com). They work well in WORD. When I employ them I enhance the picture files in PSE, then import them to WORD. They claim that there are some templates for PSE, but I have not had occasion to use them.
    There is a program called "Greeting Card Factory DeLuxe" by Nova Development. This is inexpensive is well suited for making cards, as well as certificates, posters, note cards, etc. You can use their templates or design from scratch. The page set-up is easy.
    There are other programs available as well, of couse.

  • Xml workflow/layout question - urgent

    Hi,
    I'm new to the XML scene and have made progress but have the following question.
    I have a .xls file that I open in Oxygen (xml editor) and save out a .xml file.
    I then import the .xml file into InDesign CS5.
    I have tagged the text placeholders and the image placeholders with the appropriate tags (not shown in this screen grab).
    I'd like to automatically flow the text data (A-E, J-O) into a text box (on the right side of image), then flow the images (E-I) into the picture boxes on the left side of the page. There is a large amount of data (InDesign pages) so it is important that  I configure this so that all of the content flows automatically  thoughout the InDesign file.
    Do the images need to be treated as anchored objects in a text box or is it possible to flow them into picture boxes?
    I can manually drag the "product_image" files to the picture boxes but I have yet to figure out how to automatically flow these images into the layout, aside from within the same text box as the rest of the text. Instead of using the anchored object approach, it seems it would be more efficient to flow into picture boxes if possible.
    Also, any feedback on how to get this data to flow automically thoughout the InDesign file would be really helpful.
    Thanks so much.
    Josh

    Hi,
    It is possibly to flow the images into picture boxes without treating them as anchored objects.Appropriately tagging the placeholders for graphics and text and then importing the XML file would allow the data (both text and images) to flow automatically into the respective tagged frames.
    Regards
    -Pooja

  • Problem to draw rectangle in Card LayOut.

    This is my code..i can't display the rectangle in card lay out...pls help me!
    JPanel cards;
    final static String WELCOME = "Welcome Screen";
    public void addComponentToPane(Container pane) {
    JPanel comboBoxPane = new JPanel();
         comboBoxPane.setSize(500,500);
    String comboBoxItems[] = { WELCOME};
    JComboBox cb = new JComboBox(comboBoxItems);
    cb.setEditable(false);
    cb.addItemListener(this);
    comboBoxPane.add(cb);
    //inside this is the paintComponent() method..
         AirAsiaFirstClass first = new AirAsiaFirstClass();
    JPanel card1 = new JPanel();
         JLabel label = new JLabel("WELCOME TO AIR ASIA.");
         card1.add(label);
    card1.add(first);
         card1.setSize(500,500);
    card1.setVisible(true);
    cards = new JPanel(new CardLayout());
    cards.add(card1, WELCOME);
    pane.add(comboBoxPane, BorderLayout.PAGE_START);
    pane.add(cards, BorderLayout.CENTER);
    public void itemStateChanged(ItemEvent evt) {
    CardLayout cl = (CardLayout)(cards.getLayout());
    cl.show(cards, (String)evt.getItem());
    private static void createAndShowGUI() {
    JFrame.setDefaultLookAndFeelDecorated(true);
    JFrame frame = new JFrame("Air Asia");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
         frame.setSize(500,500);
    CardLayoutDemo demo = new CardLayoutDemo();
    demo.addComponentToPane(frame.getContentPane());
    frame.setVisible(true);
    }

    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class CLD implements ItemListener {
        JPanel cards;
        final static String WELCOME = "Welcome Screen";
        public void addComponentToPane(Container pane) {
            JPanel comboBoxPane = new JPanel();
    //        comboBoxPane.setSize(500,500);
            String comboBoxItems[] = { WELCOME };
            JComboBox cb = new JComboBox(comboBoxItems);
            cb.setEditable(false);
            cb.addItemListener(this);
            comboBoxPane.add(cb);
            //inside this is the paintComponent() method..
            AAFC first = new AAFC();
            JPanel card1 = new JPanel();  // default FlowLayout
            JLabel label = new JLabel("WELCOME TO AIR ASIA.");
            card1.add(label);
            card1.add(first);
            // these next two lines have no affect
            // JPanel responds to "setPreferredSize" better than "setSize"
            // "setSize" works better for top-level containers like JFrame
    //        card1.setSize(500,500);
    //        card1.setVisible(true);
            cards = new JPanel(new CardLayout());
            cards.add(card1, WELCOME);
            pane.add(comboBoxPane, BorderLayout.PAGE_START);
            pane.add(cards, BorderLayout.CENTER);
        public void itemStateChanged(ItemEvent evt) {
            CardLayout cl = (CardLayout)(cards.getLayout());
            cl.show(cards, (String)evt.getItem());
        private static void createAndShowGUI() {
            JFrame.setDefaultLookAndFeelDecorated(true);
            JFrame frame = new JFrame("Air Asia");
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setSize(500,500);
            CLD demo = new CLD();
            demo.addComponentToPane(frame.getContentPane());
            frame.setVisible(true);
        public static void main(String[] args) {
            createAndShowGUI();
    class AAFC extends JPanel {
        int width = 150;
        int height = 55;
        protected void paintComponent(Graphics g) {
            super.paintComponent(g);
            Graphics2D g2 = (Graphics2D)g;
            g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                                RenderingHints.VALUE_ANTIALIAS_ON);
            int w = getWidth();
            int h = getHeight();
            g2.setPaint(Color.red);
            g2.drawRect(10, 10, w-20, h-20);
         * tells parent container what size this needs for display
         * without this and with no child components this JPanel
         * will report a size of either 0,0 or the default 10,10 to
         * its parent container.
        public Dimension getPreferredSize() {
            return new Dimension(width, height);
    }

Maybe you are looking for

  • Music files mysteriously missing from itunes library

    I have never had problems with my Itunes until now. Over 8GB of music has gone missing from my Itunes Library, there is still 2GB of random music left in the Library. Is there any way this could have happened as I have not done anything manually to m

  • Photos are not dispayed correctly

    All the pictures taken holding my camera vertically (portrait) are shown on the wrong side on my Iphone even if I rotated them on the computer before, Does anybody have a solution to that? Many thanks

  • Totally New Beginner

    Hi, Just got a mac G5, Dual; Presonus Firepod, and a VDRUM kit, (which is on the way). although, I'm a former full time musician, that was some 10 years ago, and I' am absolutely new to all this. Decided to join the forum to see what kind of advice I

  • Can Chrome be a satisfactory replacement for Firefox on Windows 2000 ?

    Firefox recommends Opera as a replacement. Would Chrome be as satisfactory a replacement for Windows 2000 Pro

  • Server Process taking all CPU time intermittently on Solaris

    Hi, What does my program do :- We have been facing this problem from many days, We have a server process which is continuously listening at a port on Solaris 5.8. Whenever a request is sent to this server a new thread & a socket is created for that c