(Notice!)JTabbedPane Selection Problem!!!

Hi,Everyone~
Happy new year...^^
I have a problem about JTabbedPane Component.
Shortly says,
if you made,
JTabbedPane tab = new JTabbedPane();
tab.add(A); --> A is panel or smothing like that..
tab.add(B);
tab.add(C);
you can see 2 or 3 Tab row.
when you select tab one of two row Tab,
you want to see at front row and first index whiech selected tab.
How could do it??
Please, Give me the answer~~!!

I'm not really sure what you need, but if you want to know which tab is selected just do:
int tab = JTabPane.getSelectedIndex();

Similar Messages

  • Selection Problem with JTable

    Hello,
    i have a selection problem with JTable. I want to allow only single cell selection and additionally limit the selection to the first column.
    I preffered the style from MS Outlook Express where you can select the email accounts to edit.
    It is a table like this:
    Account name  |   Type  |   ...
    --------------|---------|---------------------
    Hotmail       |   POP3  |
    GMX           |   IMAP  |The selection should be only avaibable at 'Hotmail' or 'GMX' - not at 'POP3', 'IMAP' or as complete row selection.
    Please help me!
    Thanks.
    Warlock

    Maybe this will helpimport java.awt.*;
    import javax.swing.*;
    public class Test3 extends JFrame {
      public Test3() {
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        Container content = getContentPane();
        String[] head = {"One", "Two"};
        String[][] data = {{"R1-C1", "R1-C2"}, {"R2-C1", "R2-C2"}};
        JTable jt = new JTable(data, head);
        jt.getColumnModel().setSelectionModel(new MyTableSelectionModel());
        content.add(new JScrollPane(jt), BorderLayout.CENTER);
        jt.setCellSelectionEnabled(true);
        jt.setRowSelectionAllowed(false);
        jt.setColumnSelectionAllowed(false);
        setSize(300, 300);
        setVisible(true);
      public static void main(String[] arghs) { new Test3(); }
    class MyTableSelectionModel extends DefaultListSelectionModel {
      public void setSelectionInterval(int index0, int index1) {
        super.setSelectionInterval(0, 0);
    }

  • Select Problem For 'Back Menus' - Zen V P

    Just got the Zen V Plus and tried to set the time/date. Followed the 'guide' and after the time/date screen pressed the 'back button'. Got the Set Alarm/Date/Time (etc) menu but when I selected an option (moved joystick down to desired option then pressed the joystick) the time/date display came up and I was NOT ABLE to set the date. Same thing occurred trying to set the date (tried it several times and it worked once .... then attempted again - several times (4) but it only worked once). Turns out I have the same problem with any option in ANY 'back' menu. Suggestion?
    Do I have a defecti've unit (can't be the 'operator' who is defecti've! haha)? Should I return it and try another?
    Actually not that interested in playing music .... it's more for playing .wma(DRM) book files.

    Latest ... updated my firmware (to ZENVPlus_PCFW_P4S_L2___0.exe) and it fixed the select problem for SET DATE/TIME etc however
    the SELECT procedure doesn't always work for 'back button' menus. Example: tried to set a bookmark... following procedure in 'guide', pressed 'back button' and held it, from 'NOW PLAYING' screen - works 2 out of 5 times. Most of the time, pressing and holding takes you back to the previous menu - not to the 'back' (or in this case the SET BOOKMARK) menu. Sounds like something for the next version of firmware ... the code doesn't always set an internal timer correctly (am a programmer of 30 years ... part of that time pgmmng firmware).

  • Print selection problem

    when i select a page to be print from my pc the page select in

    Hello. I feel your pain and frustration with the print selection problem in safari, especially in Snow Leopard. I have spent hours trawling help pages and forums etc. BUT YEE HAA (sorry got a bit excited, but it really was hours) I found the answer. So here goes.
    Click on Safari
    Scroll down to services then slide to right
    Scroll down to services preferences and click
    Scroll down to the Text section
    If you Tick the Text box it will choose all options for you. Or if you don't want all options in the Text list, then untick Text box and tick options you do want.
    BUT for your print selection problem make sure you tick NEW TEXT EDIT WINDOW CONTAINING SELECTION.
    Then when you want to select something in a web page you want to print (including pictures etc) then highlight it, then Right click. And low and behold, in the list is NEW TEXT EDIT WINDOW CONTAINING SELECTION. Click that, Then press cmd+p and your printing.
    I really hope that helps with your problem
    I can now go to sleep.

  • At Line selection problem

    hi,
    iam stuck up with AT LINE-SELECTION problem ie i designed a screen where they need month list on clicking F4. i got the month list using month_names_get in the screen but while clicking the relevant month no.it's not entering into the required parameter. i have attached the codings,
    MODULE MONTH_DIS OUTPUT.
      SUPPRESS DIALOG.
      LEAVE TO LIST-PROCESSING AND RETURN TO SCREEN 0.
      SET PF-STATUS SPACE.
      NEW-PAGE NO-TITLE.
      WRITE:/ 'SELECT MONTH' COLOR COL_HEADING.
      ULINE.
      DATA: T_MNTH LIKE T247 OCCURS 12 WITH HEADER LINE.
      refresh t_mnth.
      CALL FUNCTION 'MONTH_NAMES_GET'
       EXPORTING
         LANGUAGE                    = SY-LANGU
    IMPORTING
      RETURN_CODE                 =
        TABLES
          MONTH_NAMES                 = T_MNTH
       EXCEPTIONS
         MONTH_NAMES_NOT_FOUND       = 1
         OTHERS                      = 2
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      loop at t_mnth.
        write:/ t_mnth-mnr, t_mnth-ltx.
      endloop.
      CLEAR T_MNTH-MNR.
    ENDMODULE.                 " MONTH_DIS  OUTPUT
    AT LINE-SELECTION.
      p_period = t_mnth-mnr.
      CHECK NOT p_period IS INITIAL.
      LEAVE TO SCREEN 0.
    here in the AT LINE-SELECTION, the selected month is not coming to the required parameter.
    pls help me in this issue,
    Thanks in advance,
    Premnath.

    You need to set a "Hide" after the write... I suggest you also set your own dialog PF-STATUS too so you can have just a PF2 "pick" button and a Cancel button ( this will look better to the user).
    loop at t_mnth.
      write:/ t_mnth-mnr, t_mnth-ltx.
      hide: t_mnth.  "needs this
    endloop.
    clear: t_mnth.

  • Weird BGP path selection problem

    Hi, all,
    I am seeing a weird BGP path selection problem on 4948 switch running cat4500-entservicesk9-mz.122-46.SG.bin code, this switch has two uplinks to the same ISP's different edge router, one circuit is primary the other one is strict backup, only default route is accepted from ISP. I am setting both local preference and weight to the default route advertised over backup link, however neither one is taking effect, BGP still thinks the backup link is better, what could be wrong?
    rtr#sh ip bgp 0.0.0.0/0
    BGP routing table entry for 0.0.0.0/0, version 105
    Paths: (3 available, best #2, table Default-IP-Routing-Table, not advertised to EBGP peer)
      Not advertised to any peer
      17675, (received & used)
        203.169.8.37 from 203.169.8.37 (61.211.160.150)
          Origin IGP, localpref 100, valid, external
          Community: 65001:0 no-export
      17675
        203.169.8.45 from 203.169.8.45 (61.211.160.151)
          Origin IGP, localpref 90, weight 90, valid, external, best <====
          Community: 65001:0 no-export
      17675, (received-only)
        203.169.8.45 from 203.169.8.45 (61.211.160.151)
          Origin IGP, localpref 100, valid, external
          Community: 65001:0 no-export
    Thanks

    Hi,
    On cisco routers , weight is having highest preference to decide best path. By default for received route, weight is 0 but you are setting weight 90 to backup path and that is why it is getting preferred (higher is better). Please remove weight and let local preference be 90 (lesser than route on primary path)
    --Pls dont forget to rate helpful posts--
    Regards,
    Akash

  • JTabbedPane selection color

    is it possible to change the default JTabbedPane selection color? (light gray)
    It doesnt seem to give you the ability to set a Renderer

    If altering the UI for your JTabbedPane is an option for you then this becomes pretty easy, just override the "paintTabBackground" method of BasicTabbedPaneUI. This isn't an option for a lot of people though... since that would pretty much limit you to one UI.
    Otherwise you will have set the background of the tab manually... the following code is an example of how to do this... unfortunatly... MetalTabbedPaneUI overrides the paintTabBackground method and DOESN'T use the manual backgrounds for selected tabs, it ALWAYS uses the default selectedColor from the UIManager... looks like an oversite to me... anyway... this code works fine with the Windows Look and Feel...
    import javax.swing.*;
    import javax.swing.event.ChangeListener;
    import javax.swing.event.ChangeEvent;
    import java.awt.*;
    * <pre>
    * SBTabbedPane
    * </pre>
    public class SBTabbedPane extends JTabbedPane {
         private Color tback;
         private int tsel = -1;
         private Color sback;
         public SBTabbedPane() {
              addChangeListener(new ChangeListener() {
                   public void stateChanged(ChangeEvent e) {
                        redoback();
         public void setSelectionBackground(Color c) {
              sback = c;
              redoback();
         private void redoback() {
              if (tsel >= 0) {
                   setBackgroundAt(tsel, tback);
              int i = getSelectedIndex();
              if (sback != null && i >= 0) {
                   tback = getBackgroundAt(i);
                   tsel = i;
                   System.out.println("SET BACK: " + tsel + ": " + sback);
                   setBackgroundAt(tsel, sback);
         public static final void main(String[] args) {
              try {
                   UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
              } catch (Exception e) {}
              SBTabbedPane test = new SBTabbedPane();
              test.setSelectionBackground(new Color(255,0,0));
              test.add("Tab 1", new JLabel("HELLO"));
              test.add("Tab 2", new JLabel("WORLD"));
              JFrame testframe = new JFrame("Test Window");
              testframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              testframe.getContentPane().setLayout(new BorderLayout(0, 0));
              testframe.getContentPane().add(test);
              testframe.pack();
              testframe.setVisible(true);
    }Hope this helps a little...
    Josh Castagno
    http://www.jdc-software.com

  • Certificate selection problem in Safari

    Hi ,
    I have certifcates A,B,C,D for the same site , whenever i use the Mozilla it is asking which one to select , but somehow i dont know why Safari is asking the same option.
    It is forcing me to accept Certifcate A to that paricular site. How to solve this problem in safari.
    Regards
    Vikranth

    Hello. I feel your pain and frustration with the print selection problem in safari, especially in Snow Leopard. I have spent hours trawling help pages and forums etc. BUT YEE HAA (sorry got a bit excited, but it really was hours) I found the answer. So here goes.
    Click on Safari
    Scroll down to services then slide to right
    Scroll down to services preferences and click
    Scroll down to the Text section
    If you Tick the Text box it will choose all options for you. Or if you don't want all options in the Text list, then untick Text box and tick options you do want.
    BUT for your print selection problem make sure you tick NEW TEXT EDIT WINDOW CONTAINING SELECTION.
    Then when you want to select something in a web page you want to print (including pictures etc) then highlight it, then Right click. And low and behold, in the list is NEW TEXT EDIT WINDOW CONTAINING SELECTION. Click that, Then press cmd+p and your printing.
    I really hope that helps with your problem
    I can now go to sleep.

  • JTabbedPane display problems

    Can someone help me with this? I have a JTabbedPane in an applet with two tabs. Lately I have noticed that when I move the mouse pointer around on one tab, some components from the other tab start to show through and I can even click on them, resulting in other components showing through and a jumbled mess. Can anyone help me?
    Here is how I set up the layout in the init method:
    jPanelUI = new MyUIPanel();
    getContentPane().setLayout(new GridLayout(1,1,0,0));
    jPanelUI.setLayout(new GridLayout(1,1,0,0));
    // add look & feel panel to content pane
    getContentPane().add(jPanelUI);
    // add main panel to look & feel panel
    jPanelUI.add(administrationPanel);
    Here is MyUIPanel:
    public class MyUIPanel extends javax.swing.JPanel implements my.data.MyConstants
         public MyUIPanel()
         super();
         UIManager.put("TabbedPane.selected", CONTROL);
         UIManager.put("TableHeader.background", CONTROL);
         UIManager.put("ScrollBar.arrowColor", Color.green);
         UIManager.put("ScrollPane.background", CONTROL);
         UIManager.put("ScrollPane.foreground", CONTROL);
    I add the JTabbedPane to Administration panel like this...
    jTabbedPaneAdministration.setRequestFocusEnabled(false);
    jTabbedPaneAdministration.setOpaque(true);
    add(jTabbedPaneAdministration, new com.symantec.itools.awt.GridBagConstraintsD(0,2,6,10,0.5,0.5,java.awt.GridBagConstraints.WEST,java.awt.GridBagConstraints.BOTH,new Insets(15,20,20,20),0,0));
    jTabbedPaneAdministration.setBackground(new java.awt.Color(204,204,153));
    jTabbedPaneAdministration.setFont(new Font("Dialog", Font.PLAIN, 12));
    I add my two panels to administration panel like this...
    jTabbedPaneAdministration.add(jPanel1);
    jTabbedPaneAdministration.add(jPanel2);
    Any ideas?
    Thanks a bunch

    Found the problem. On the invisible tab, I was setting visibilities, depending on what components the user had permission to see. I assumed that those visibilities would only take effect on the tab that they were on, but instead they showed right through the selected tab. So it wasnt the resizing but your idea made me look to what I was doing with those panels after adding them, and I found it. Enjoy your duke $s
    Thanks

  • Photoshop CS6 [ Command + Click ] Layer Selection "Problem" Solved

    Good afternoon fellas,
    I've recently noticed something uncommon when working with Photoshop CS6 under Mac OS X 10.8.x.
    When I naturally tried to select a Layer by the [ Command + Click ] (let's say) shortcut, it failed. This little thing was driving me nuts, and I know it must be getting some people hairless, too.
    Anyway(s), by looking another read-only thread, I noticed the problem has not been solved and some pretty lame recommendations were given. By try, I finally found the solution and was able to fix this little annoyance that maybe we've all been through. So here it goes the workaround, so maybe you'll never consider downgrading to 5.5 again like I was considering:
    1) In Photoshop, make sure the Move Tool is selected by pressing "V";
    2) In the tool's submenu, forget about selecting/marking "Auto-Select". I know it sounds nonsense, trust me;
    3) Although, make sure "Layer" is selected right next to the "Auto-Select" button, and you should be done as I am.
    Hope this can help a few people! I would be very happy to know, since I just created this account to help you guys out.
    I don't know if this issue has been solved and posted already, I'm sorry. I just want to make sure we'll be all happy!
    Cheers,
    "Let it go, Jack."

    Did you actually took a look into Photoshop CS 6 before posting?
    Been using Photoshop since legacy 6.0.
    This was one feature that started off without being able to enable/ disable 'auto-select' sometime in 2003-2004 releases which was later appended to newer versions of Photoshop.
    I see your screenshot and I'm aware there is a 'tick' mark that appears next to Layer or Group when you choose either of them.
    But, without enabling 'auto-select', the selection you make in that dropdown will not have any effect.
    Try it for yourself.
    Create a new document
    Create any layer (rectangle, ellipse, whatever)
    Once created, deselect all layers (layers panel should not highlight any layer)
    Disable auto select. Choose 'Layer' from dropdown. Single click on the layer you just created. See what Photoshop says
    Now enable auto select. Choose 'Layer' from dropdown. SIngle click on the layer you just created. See what happens in Photoshop (Layers Panel)
    Cause I really wouldn't waste my time posting something wrong.
    I didn't say you posted something wrong. Neither would I be 'wasting' my time in responding to a post that I feel is incorrect. End of the day, this is a community and we're here to help each other and at no time should other fellow members be deceived by incorrect information.
    -ST

  • JSplitPane within JTabbedPane display problem

    What am I missing??? I have a JSplitPane in a TabbedPane.
    The topComponent contains a JComboBox with Key values, the
    Bottom Component will display details based on the key
    value passed from the TopComponent. The bottomComponent
    has 2 constructors: one default and one accepting an Argument.
    The default constructor instantiate the class that would
    represent the data and formats the bottomComponent. The second
    constructor retrieves the data from an Oracle database
    and formats the BottomComponent using the same method.
    I put System.out messages in the formatting method and the
    values are showing using the Second constructor.
    The problem is displaying the detail data after the Key is
    selected and passed from the Top Component. The Page is
    initially displayed with the BottomComponent without any
    values displayed. After the Key is selected from the
    topComponent, the value is passed to the bottomComponent
    (which is a Class). I access the data, issue setText(...)
    on the fields BUT the screen display does not reflex the
    values. I issue a System.out.print for the fields and
    there's data there.
    I don't understand why the page doesn't display the data.
    Your help is greatly appreciated

    import javax.swing.*;
    import javax.swing.event.*;
    import java.awt.*;
    import java.awt.event.*;
    public class Management extends JPanel implements ChangeListener{
    //private JFrame dlframe;
    private JTabbedPane propPane;
    public Management(){
    propPane = new JTabbedPane(SwingConstants.TOP);
    propPane.setSize(795, 550);
    propPane.addChangeListener(this);
    populateTabbedPane();
    // getContentPane().add(propPane);
    add(propPane);
    } // end of constructor
    // create tabs with titles
    private void populateTabbedPane(){
         propPane.addTab("Management", null, new Mgmt(), "Management");
         propPane.addTab("Management Contact", null,
    new Management_Contact(), "Management Contact");
    } // end of populateTabbedPane
    public void stateChanged(ChangeEvent e){
         System.out.println("\n\n ****** Management.java " + propPane.getSelectedIndex() + " " + propPane.getTabPlacement());
    public static void main(String[] args){
    Home dl = new Home();
    dl.pack();
    dl.setSize(800, 620);
    dl.setBackground(Color.white);
    dl.setVisible(true);
    } // end of class
    import java.util.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import java.awt.*;
    import java.awt.event.*;
    public class Management_Contact extends JPanel {
         Mgmt_Class mgmt = null;
         Mgmt_Contact mgmtContact = null;
         public Management_Contact() {
              JSplitPane split = new JSplitPane();
              split.setOrientation(JSplitPane.VERTICAL_SPLIT);
              Mgmt_Header hdr = new Mgmt_Header();
              split.setTopComponent(hdr);
              Mgmt_Contact mgmtContact = new Mgmt_Contact();
              JScrollPane scrollPane = new JScrollPane(mgmtContact,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
              JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
              scrollPane.setPreferredSize(new Dimension(650,300));
              split.setBottomComponent(scrollPane);
              add(split);
    } // end of Management class
    import java.util.Vector;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class Mgmt_Header extends JPanel implements ActionListener{
    private JComboBox cmbMgmt;
    private JTextField txtMgmtCode;
    private JTextField txtMgmtAddr1;
    private JTextField txtMgmtAddr2;
    private JTextField txtMgmtCity;
    private JButton sel;
    private JLabel lblBlk;
    private JPanel pWork;
    private Box vertBox;     
    private Box topBox;     
    private Box midBox;     
    private Box botBox;     
    JToolTip toolTip = null;
    private Mgmt_Class mClass = null;
    private Mgmt_Contact cnt = null;
    Vector mgmtVct = null;
    public Mgmt_Header(){
         vertBox = Box.createVerticalBox();
         topBox = Box.createHorizontalBox();
         midBox = Box.createHorizontalBox();
         botBox = Box.createHorizontalBox();
    mClass = new Mgmt_Class();
    mgmtVct = new Vector();
         cmbMgmt = new JComboBox();
         cmbMgmt.addItem(" ");
         mgmtVct = mClass.bldMgmtHeader();
         for (int x1=0; x1<mgmtVct.size() ;x1++ )
              mClass = (Mgmt_Class)mgmtVct.get(x1);
              cmbMgmt.addItem(mClass.getManagementName());
    System.out.println("MgmtHeader " + mgmtVct.size() + " " + cmbMgmt.getItemCount());
         cmbMgmt.setEditable(false);
         cmbMgmt.setBackground(Color.white);
         cmbMgmt.setName("cmbMgmt");
         cmbMgmt.setPreferredSize(new Dimension(250,27));
         cmbMgmt.setFont(new Font("Times-Roman",Font.PLAIN,12));
         cmbMgmt.addActionListener(this);
         pWork = new JPanel();
         pWork.setLayout(new FlowLayout(FlowLayout.CENTER));
         pWork.setBorder(BorderFactory.createTitledBorder(" Select Management Name "));
         pWork.add(new JLabel("Name: "));
         pWork.add(cmbMgmt);
         topBox.add(pWork);
         txtMgmtAddr1 = new JTextField("Address line 1",15);
         txtMgmtAddr1.setEditable(false);
         txtMgmtAddr2 = new JTextField("Address line 2",15);
         txtMgmtAddr2.setEditable(false);
         txtMgmtCity = new JTextField("City",15);
         txtMgmtCity.setEditable(false);
         midBox.add(midBox.createVerticalStrut(10));
         botBox.add(new JLabel("Address:"));
         botBox.add(topBox.createHorizontalStrut(15));
         botBox.add(txtMgmtAddr1);
         botBox.add(topBox.createHorizontalStrut(15));
         botBox.add(txtMgmtAddr2);
         botBox.add(topBox.createHorizontalStrut(15));
         botBox.add(txtMgmtCity);
         vertBox.add(topBox);
         vertBox.add(midBox);
         vertBox.add(botBox);
         add(vertBox);
    } // end of constructor
    public void actionPerformed(ActionEvent evt){
         if (evt.getSource() instanceof JComboBox){
         if (((JComboBox)evt.getSource()).getName() == "cmbMgmt"){
         int sel = ((JComboBox)evt.getSource()).getSelectedIndex();
    System.out.println("ActionListener " + sel + " " + ((JComboBox)evt.getSource()).getItemAt(sel) + " " + cmbMgmt.getItemAt(sel));
         Mgmt_Class mClass = (Mgmt_Class)mgmtVct.get(sel - 1);
    System.out.println("From Vector " + mClass.getAddress1() + " " + mClass.getAddress2() + " " + mClass.getManagementCode());
         txtMgmtAddr1.setText(mClass.getAddress1());
         txtMgmtAddr2.setText(mClass.getAddress2());
         txtMgmtCity.setText(City.getCityName(mClass.getCityCode()));
    System.out.println("\n\nListener " + ((JComboBox)evt.getSource()).getSelectedItem() + " " + (((JComboBox)evt.getSource()).getSelectedIndex()) );
         int mCode = mClass.getManagementCode();
         cnt = new Mgmt_Contact(mCode);
    System.out.println("\n After new Mgmt_Contact constructor");
              } // end of JComboBox
         } // end of actionPerformed
    } // end of Mgmt_Header
    import java.util.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.sql.*;
    import java.io.*;
    public class Mgmt_Contact extends JPanel implements KeyListener{
         private Mgmt_Contact_Class contact = null;
         private DefaultFocusManager mgr = null;
         private JTextField txtFName = null;
         private JTextField txtLName = null;
         private JTextField txtAddr1 = null;
         private JTextField txtAddr2 = null;
         private JButton btnUpd = null;
         private JButton btnNew = null;
         private JButton btnDel = null;
         private JButton btnNext = null;
         private JButton btnPrior = null;
         private JButton btnSel = null;
         private JPanel cntct = null;
         private JPanel pWork = null;
         private JPanel pWest = null;
         private JPanel pEast = null;
         private JPanel pNorth = null;
         private JPanel pSouth = null;
         private JPanel pCenter = null;
    public Mgmt_Contact() {
         System.out.println("\n MgmtContact default constructor");
              contact = new Mgmt_Contact_Class();
              bldPage();
         System.out.println("\n ******* After bldPage() routine");
         public Mgmt_Contact(int mCode) {
    System.out.println("\n MgmtContact second constructor " + mCode);
         Vector mgmtVct = new Vector();
         contact = new Mgmt_Contact_Class();
         mgmtVct = contact.bldMgmtContactTbl(mCode);
         contact =(Mgmt_Contact_Class)mgmtVct.get(0);
    System.out.println("\n ******* Management Contact Table *** " + contact.getFirstName());          
         bldPage();
    System.out.println("\n ******* After bldPage() routine");
         public void bldPage(){
    System.out.println("\n MgmtContact bldPage ");
              cntct = new JPanel();
              cntct.setLayout(new BorderLayout());
              pWest = new JPanel();
              pWest.setLayout(new GridLayout(0,1));
              pCenter = new JPanel();
              pCenter.setLayout(new GridLayout(0,1));
              pNorth = new JPanel();
              pNorth.setLayout(new FlowLayout(FlowLayout.CENTER));
              pSouth = new JPanel();
              pSouth.setLayout(new FlowLayout());
              pWork = new JPanel();
              pWork.setLayout(new FlowLayout(FlowLayout.LEFT));
              pWest.add(new JLabel("First :"));
              txtFName = new JTextField(15);
              txtFName.setText(contact.getFirstName());
    System.out.println("\n First Name " + txtFName.getText() + " " + contact.getFirstName());
              txtFName.setPreferredSize(new Dimension(200,27));
              txtFName.addKeyListener(this);
              txtFName.setName("txtFName");
              pWork.add(txtFName);
              pWork.add(new JLabel("Last :"));
              txtLName = new JTextField(15);
              txtLName.setText(contact.getLastName());
              txtLName.setPreferredSize(new Dimension(200,27));
              txtLName.setName("txtLName");     
              txtLName.addKeyListener(this);
              pWork.add(txtLName);
              pCenter.add(pWork);
              pWork = new JPanel();
              pWork.setLayout(new FlowLayout(FlowLayout.LEFT));
              pWest.add(new JLabel("Address :"));
              txtAddr1 = new JTextField(15);
              txtAddr1.setText(contact.getAddress1());
              txtAddr1.setPreferredSize(new Dimension(200,27));
              txtAddr1.addKeyListener(this);
              txtAddr1.setName("txtAddr1");
              pWork.add(txtAddr1);
              pWork.add(new JLabel(" "));
              txtAddr2 = new JTextField(15);
              txtAddr2.setText(contact.getAddress2());
              txtAddr2.setPreferredSize(new Dimension(200,27));
              txtAddr2.setName("txtAddr2");
              txtAddr2.addKeyListener(this);
              pWork.add(txtAddr2);
              pCenter.add(pWork);
              pWork = new JPanel();
              pWork.setLayout(new FlowLayout(FlowLayout.LEFT));
              btnUpd = new JButton("Update");
              btnUpd.addActionListener(new ButtonListener());
              btnDel = new JButton("Delete");
              btnDel.addActionListener(new ButtonListener());
              btnNew = new JButton(" Add ");
              btnNew.addActionListener(new ButtonListener());
              btnNext = new JButton(" Next ");
              btnNext.addActionListener(new ButtonListener());
              btnPrior = new JButton(" Prior ");
              btnPrior.addActionListener(new ButtonListener());
              btnSel = new JButton(" Select ");
              btnSel.addActionListener(new ButtonListener());
              pSouth.add(btnNew);
              pSouth.add(btnUpd);
              pSouth.add(btnDel);
              pSouth.add(btnNext);
              pSouth.add(btnPrior);
              pSouth.add(btnSel);
              cntct.add("West", pWest);
              cntct.add("Center", pCenter);
              cntct.add("South", pSouth);
              add(cntct);
         class ButtonListener implements ActionListener{
         public void actionPerformed(ActionEvent e){
              System.out.println("ButtonListener " + e.getActionCommand() + " " +
              contact.getString());
    // KeyListener Interface
         public void keyPressed(KeyEvent e){
         public void keyReleased(KeyEvent e){
              mgr = new DefaultFocusManager();
              Component comp = e.getComponent();
              Object obj = ((JTextField)e.getSource());
              if ((ColUtils.isMaxField(obj))){
              mgr.focusNextComponent(comp);
         } // end of KeyReleased
         public void keyTyped(KeyEvent e){
              char num = e.getKeyChar();
              Object obj = ((JTextField)e.getSource());
              if (ColUtils.isDataValid(num, obj)){
              else {
              e.consume();
              System.out.println(num + " Rejected Data");
         } // end of keyTyped
    } // end of Mgmt_Contact class

  • JTabbedPane selected tab size

    Hello everybody;
    I've created a JTabbedPane with JLabel on each tab and i want that the selected one size be larger than the other tabs.
    The problem is that if I increase the size of the selected tab, all the others (inselected tabs) do so (they take the same size as the selected one) which is normal.
    My need is to change this default behavior in order to fix the inselected tab size and increase the selected one to appear bigger
    Thank you for your help

    Hello,
    - JDK 6
    - MetalLookAndFeel
    - JTabbedPane#getTabPlacement()==TOP
    - Selected tab "width" only grow
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class SelectedTabSizeTest{
      private static void addTab(JTabbedPane t, String title, Component c) {
        t.addTab(title, c);
        JLabel label = new JLabel(title, SwingConstants.CENTER);
        t.setTabComponentAt(t.getTabCount()-1, label);
      public JComponent makeUI() {
        JTabbedPane t = new JTabbedPane() {
          private void initTabWidth() {
            int tabCount  = getTabCount();
            if(tabCount==0) return;
            int bigger   = 50;
            int tabWidth = 30;
            int si = getSelectedIndex();
            for(int i=0;i<tabCount;i++) {
              JLabel l = (JLabel)getTabComponentAt(i);
              if(l==null) continue;
              int w = tabWidth+(si==i?bigger:0);
              int h = l.getPreferredSize().height;
              l.setPreferredSize(new Dimension(w, h));
          @Override public synchronized void repaint() {
            initTabWidth();
            super.repaint();
        t.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
        addTab(t, "JTree",      new JScrollPane(new JTree()));
        addTab(t, "JTextArea",  new JScrollPane(new JTextArea("aaaa")));
        addTab(t, "Preference", new JScrollPane(new JTree()));
        addTab(t, "Help",       new JScrollPane(new JTextArea("bbbbbb")));
        t.setPreferredSize(new Dimension(320, 200));
        return t;
      public static void main(String[] args) {
        EventQueue.invokeLater(new Runnable() {
          public void run() { createAndShowGUI(); }
      public static void createAndShowGUI() {
        JFrame f = new JFrame();
        f.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        f.getContentPane().add(new SelectedTabSizeTest().makeUI());
        f.pack();
        f.setLocationRelativeTo(null);
        f.setVisible(true);
    }

  • JTabbedPane addChangeListener problem

    My application uses a JTabbedPane. Whenever data has changed on one tab and the user navigates to another I will display a JOptionPane asking if the user wants to save the changed data. My problem is that I want the tab with unsaved data to remain selected until the user has answered yes or no. As is the tab will change and then display the JOptionPane. Strangely this works as intended on some Java versions, but I would like to find a more universal approach.
    is there another way of achieving the desired behaviour?
    My code:
    tabbedPane.addChangeListener(new ChangeListener() {
    public void stateChanged(ChangeEvent evt) {
    if (globalUpdateModel.isModelUpdated()) {
    if (userConfirmedSaveChanges()) {     //this is the metod displaying the JOptionPane
    saveAction.actionPerformed(null);
    } else {
    searchAction.actionPerformed(null);
    });

    tabbedPane.addChangeListener(new ChangeListener() {
                public void stateChanged(ChangeEvent evt) {
                    if (globalUpdateModel.isModelUpdated()) {
                        if (userConfirmedSaveChanges()) {
                            saveAction.actionPerformed(null);
                        } else {
                            searchAction.actionPerformed(null);
            });

  • JTabbedPane.setComponentAt() problem

    I think I have come across a bug with JTabbedPane. If you have tabs with titles that are HTML strings if you call setComponentAt() on the pane the tab titles are redrawn incorrectly.
    For example if you call setComponentAt(index, comp) where the tab at 'index' has HTML for the title the title at index + 1 is drawn as the title from 'index'.
    Also, if you call setComponentAt(index, comp) where the tab at 'index' does not have an HTML title, but the tab at index + 1 does, the title at index + 1 is drawn to show the actual HTML code.
    I have put together a small test program that shows the results.
    import javax.swing.*;
    public class TabTest extends JFrame {
        private JTabbedPane pane;
        public TabTest() {
            setDefaultCloseOperation(DISPOSE_ON_CLOSE);
            pane = new JTabbedPane();
            pane.addTab("Test 1", new JPanel());
            pane.addTab("<HTML><b><font color = 'Red'>Test 2</font></b></HTML>", new JPanel());
            pane.addTab("<HTML><b>Test 3</b></HTML>", new JPanel());
            add(pane);              
        public void changeSecondTabTest() {
            pane.setComponentAt(1, new JPanel());
        public void changeFirstTabTest() {
            pane.setComponentAt(0, new JPanel());
        public static void main(String[] args) {
            TabTest frame = new TabTest();
            frame.pack();
            frame.setVisible(true);
            try {
                Thread.sleep(2000);
                frame.changeSecondTabTest();
                JOptionPane.showMessageDialog(frame, "Notice the tab title for the third tab is incorrect");
                Thread.sleep(2000);
                frame.changeFirstTabTest();
                JOptionPane.showMessageDialog(frame, "Please click on the second tab and notice the change");
            } catch (InterruptedException e) {
                e.printStackTrace();
    }Sun Bug ID #5022375 seems like it might be related, but it is supposed to be fixed.
    Does anyone know of a workaround for this or if this is a known bug? Or am I just doing something completely wrong?
    Thank you,
    Cameron

    One thing that is obvious from your sample code is you are making Swing calls from outside the swing event thread. I don't know if changing that would solve your problem or not. Try this
       public static void main(String[] args) {
            TabTest frame = new TabTest();
            frame.pack();
            frame.setVisible(true);
    Runnable r = new Runnable () {
    public void run() {
            try {
                Thread.sleep(2000);
                frame.changeSecondTabTest();
                JOptionPane.showMessageDialog(frame, "Notice the tab title for the third tab is incorrect");
                Thread.sleep(2000);
                frame.changeFirstTabTest();
                JOptionPane.showMessageDialog(frame, "Please click on the second tab and notice the change");
            } catch (InterruptedException e) {
                e.printStackTrace();
    SwingUtilities.invokeLater(r);
        }

  • Flash CS4 multiple selection probleme, Scale/position

    Hello.
    i noticed that if you have a flash cs4 AS2 where you need to make a zoom and unzoom effect on multiple element, you will have a painfull time building that scale+position effect. Let me explain.
    Everything need to be scaled from 0 to 100 % and then from 100 % to 0. Some of those need to be scale in the exact position where they are, but other need to also move to fit the zoom effect for a result of a central effect for everything ). For some unknow reason the Tween is not working for those item. So i had to do it manually using 50 keyframe of 1 frame ( ho joy... dont forget to times that by 19)
    We all know that when you use the free transform tools, you have the transform box + the little circle that define the effect "center" location of the item. Whatever the location of that little circle, when you zoom it will go away in the opposite direction and the reverse is also true. So far it work perfectly.
    however if you take the time to set that little circle for all your element perfectly and test it with all element, you should be able to select ALL of your element at the same time and execute the same move as if you were doing it on a single element right ?. Well no.
    If you do it with a single element and play with the scale ( with constraint) it does what you want. But if you select them all, you discover quickly enough that it is no longer working. You also discover that it is adding a NEW little circle ( "center" position) that is offset. Fair enough, i move that circle at the exact location of the zoom effect then try to make the zoom, and TADAM.. it is not working, it is still messing with the direction of the scale/position.
    Ctrl Z. unselect everything, and try again with only 1 random element ? work perfectly. Try with all of them at the same time ? dont work.
    REmember all those element zoom at the same location, so you shouldn't have any probleme with the new little circle as long you move it at the same spot than the other. But no. even if it is there, it will still scale/position South of where it suposed to be. Doing it all at the same time while setting that circle should save you time, but right now it is the exact opposite, an effect that could take 1 hour to make will take me the full day, if not more.
    any clue ?
    I do hope i'm clear enough
    Thx.

    Yes Kglad, that the little circle thing i was speaking about.
    It is set manually to fit the design and if i select my item 1 by 1 and zoom them manually, it is working.
    The bug is when you select them all ( AFTER setting all the registration point ) you will get another one that is not set, so even if you set it manually at that time ( when all is selected ) and THEN apply the zoom, it will no longer work.
    thats the bug.

Maybe you are looking for

  • Creating Hyperlink to Another Report in Same Document

    Hi Is it possible to create a hyperlink from a cell in one report, to another report in the same WebI document, that doesn't involve the entire reloading of the document. Also, I want to be able to pass through a filter value. The reason for the requ

  • How to restrict material output in the report published in the portal

    Hi all, I am new to BI 7.  I have a series of materials that start with the material IDs TR52, RL25, XY56 and son on.  Now my user wants to view only the materials that are starting with the ID TR52 when he runs the report from the portal. In the mat

  • Payment request for customer

    Hi guys, payment request for customer T.code f-59 we got an error "Special G/L indicator J for payment request is not a noted item"  urgent thanks & regards syam

  • How do export a double page spread photo to epub and fill an ipad screen?

    I'm completely new to indesign. I'm using XP and Indesign CS6.  I'm testing my epub on the new IPad 3. I've published numerous books in print form with major publishing house in the US.  I need to quickly get a copy of the book in epub format for pub

  • File not coming at FTP server

    Hi, I am doing Idoc to File scenario...In receiver communication channel FTP server is to be used...Data is processing successfully in sxmb_moni...but its not visible at FTP server....have checked at all the places... Please help.