Menutab not shown properly when second menu-item is selected.

When my menutabs are shown everything seems fine, but when you click the 2nd menu-tab the first menu-tab isn't shown properly anymore.
If I have a look at the code-source I can see that the first gif that's needed for the tabbed-view isn't present anymore if the 2nd menu-tab is clicked.
Could somebody explain the different skins that are used by the menuTab component so I know if maybe I've forget to define a specific in my custom skin?
Maybe somebody already used custom skins with your custom images for the tabbed view of menuTabs?
Regards,
Nathalie

>
Yes, you are right. In this sample program,
paintcomponent() is not really necessary, but it is in
the real program I am doing. So I can not get rid of
the paintComponent() method. In this paintComponent()
method I have added (add) and painted (paint) several
JComponent objects and this is the only one which
fails. I can not find the reason why.
Regards.
the reason is that on each call to paint , you add new components to the panel.
the scenario goes like this:
1. frame is made visible -> paintComponent() gets called - > fillPanel() gets called ,
so on the panel are the following 4 components:
one JButton
one JTextField
one JCheckBox
one ComboBox
2. click on the combobox, -> the popup list of the combo is displayed -> paintComponent() is called -> fillPanel() is called
so you have 8 components on the panel;
The popup list remain visible, is not actualy contained in the PanelNullLayout component due to the swing mecanics
3. you select an option in the list, the list becomes invisible, paint() gets called -> fillPanel getsCalled(),
so, again four componets are added. you have 12 components in the panel.
The components are painted in the order they have been added to therir container. The first combo box, that you first clicked, has selected index 1, but the last two have selected index 0. As these two are added after the first one, they are painted "above" first one, so you see the last comboBox added.
Add this code to the paintComponet method if you did not understand
// public void paintComponent(Graphics g) {
// super.paintComponent(g);
// fillPanell();
int count = getComponentCount();
System.out.println("Total components :" +count);
for ( int i = 0; i < count; i++ ) {
Component c = getComponent(i);
if ( c instanceof javax.swing.JComboBox ) {
System.out.println("Selected index in combo " i+" :"+( (JComboBox) c ).getSelectedIndex() );

Similar Messages

  • How to make menu to auto close when a menu item is selected?

    hi ...my question is described above..
    to make things clearer i have written a mini code to demonstrate my problem
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import javax.swing.*;
    /* just a frame with a JMenuBar with a JMenu with two RadioButtons
    public class myFrame2 extends JFrame implements ActionListener{
         JMenuBar mb ;
         JMenu mi;
         JRadioButton rb1;
         JRadioButton rb2;
         public myFrame2(){
              super();
              mb = new JMenuBar();
              mi = new JMenu("New");
              rb1 = new JRadioButton("Button 1");
              rb1.addActionListener(this);
              rb1.setActionCommand("action1");
              rb2 = new JRadioButton("Button 2");
              rb2.addActionListener(this);
              rb2.setActionCommand("action2");
              mi.add(rb1);
              mi.add(rb2);
              mb.add(mi);
              setJMenuBar(mb);
              pack();
              setVisible(true);
         @Override
         public void actionPerformed(ActionEvent e) {
              // Do something......
         public static void main(String args[]){
              new myFrame2();
    }If you run this program you will see that when you select a RadioButton the menu doesn't hide ...
    How can i make it hide when a menu item (JradioButton) is selected?
    thanks in advance
    Edited by: Pitelk on Jun 10, 2008 7:42 AM

    On a menu use JRadioButtonMenuItem.
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class JRadioButtonMenuItemExample {
        public static void main(String[] args) {
            EventQueue.invokeLater(new Runnable(){
                public void run() {
                    launch();
        static void launch() {
            JMenuBar mb = new JMenuBar();
            JMenu menu = new JMenu("menu");
            mb.add(menu);
            ButtonGroup bg = new ButtonGroup();
            JRadioButtonMenuItem item1 = new JRadioButtonMenuItem("alpha");
            bg.add(item1);
            menu.add(item1);
            JRadioButtonMenuItem item2 = new JRadioButtonMenuItem("beta");
            bg.add(item2);
            menu.add(item2);
            JRadioButtonMenuItem item3 = new JRadioButtonMenuItem("gamma");
            bg.add(item3);
            menu.add(item3);
            JFrame f = new JFrame();
            f.setJMenuBar(mb);
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            f.setSize(400, 300);
            f.setLocationRelativeTo(null);
            f.setVisible(true);
    }

  • Why do the youtube clips not expand properly when I double click on the page

    why do the youtube clips not expand properly when I double click on the page

    The exclamation mark is telling you that iPhoto has broken the file path/link to the original file. Assuming you're using iPhoto 9 or later Apply the two fixes below in order as needed:
    Fix #1
    1 - launch iPhoto with the Command+Option keys held down and rebuild the library.
    2 - run Option #4 to rebuild the database.
    Fix #2
    Using iPhoto Library Manager  to Rebuild Your iPhoto Library
    1 - download iPhoto Library Manager and launch.
    2 - click on the Add Library button and select the library you want to add in the selection window..
    3 - Now that the library is listed in the left hand pane of iPLM, click on your library and go to the Library ➙ Rebuild Library menu option.
    4 - In the next  window name the new library and select the location you want it to be placed.
    5 - Click on the Create button.
    Note: This creates a new library based on the LIbraryData.xml file in the library and will recover Events, Albums, keywords, titles and comments but not books, calendars or slideshows. The original library will be left untouched for further attempts at fixing the problem or in case the rebuilt library is not satisfactory.
    OT

  • My Ipod touch does not work properly.When i charge it,it only works for 5 min.n gets discharge.I showed it to the apple store in banglore n the person told me its fine n It is working properly.Bt its not working properly.Can someone help

    My Ipod touch does not work properly.When i charge it,it only works for 5 min.n gets discharge.I showed it to the apple store in banglore n the person told me its fine n It is working properly.Bt its not working properly.Can someone help

    If after you charge it for about three hours and it only last about five minutes the battery is probably dead or there could be another hardware problem.  I would go back to the Apple store and ask them specifically how can it be OK if the fully charged battery only lasts five minutes.

  • Clip inspector in imovie not working properly - when I select a picture - and select clip adjustment it tells me that I need to select one or more clips to view Inspector tools and in a clip the audio adjustment only shows a speaker? help

    Clip inspector in imovie not working properly - when I select a picture (in project library) - and select clip adjustment it tells me that I need to select one or more clips to view Inspector tools and when I select a movie clip and then click on audio adjustments the audio adjustment appears as a speaker icon and I don't know how to get to the various audio options? It was working fine one minute and then I seemed to lose the functionality. Also editing a photo in a photo or getting rid of ken burns effect etc does not seem to work. help

    Can anyone shed any light on this as I am having the same problem? One minute it works fine, the next you get the error message above.
    Many thanks.

  • Hello My ipads Power button is not working properly when I press it once it shows option to turn off instead of locking and some other display problems like it suddenly lockes down or display disappears ...Please help. Thank You

    Hello My ipads Power button is not working properly when I press it once it shows option to turn off instead of locking and some other display problems like it suddenly lockes down or display disappears ...Please help. Thank You

    Thanks for that information!
    I'm sure I will be calling AppleCare, but the problem is, they charge for the phone calls don't they? Because I don't have money to be spending to be on the phone with a support service.
    In other things, it seemed like the only time my MacBook was working was when I had Snow Leopard without the 10.6.8 update download that was supposed to be done to prepare for OS X Lion.
    When I look at the information of my HD it says that I have 10.6.8 but that was the install that it claimed to have failed and caused me to restart resulting in all of the repeated problems.
    Also, because my computer is currently down, and I've lost all files how would that effect the use of my iPhone? Because if it doesn't get fixed by the time OS 5 is released, how would I be able to upgrade?!

  • My macbook pro is not working properly , when is turned on after then show apple logo and continue show this or nothing.

    my macbook pro is not working properly , when is turned on after then show apple logo and continue show this or nothing

    Gray, Blue or White screen at boot, w/spinner/progress bar

  • I've an iphone 4, its headset jack is not working properly, when i insert the earphone no sound is coming, but when i keep the earphone little out i can hear the sound but very low sound is coming out, I've never dropped my iphone please help...

    I've an iphone 4, its headset jack is not working properly, when i insert the earphone no sound is coming, but when i keep the earphone little out i can hear the sound but very low sound is coming out, I've never dropped my iphone please help...

    bunjamin wrote:
    There is now a new line in BBM that wasn't there before which covers the message that I am typing, so I can't actually see what I am typing.
    Hi bunjamin,
    just go to BlackBerry World, and update all your apps including BBM.
    bunjamin wrote:
    Every time I unlock my phone, my screen enlarges so I can't really see much on the hub/notification screen and it defaults to the hub which it didn't do before).
    you can turn off the magnifying glass :
    device settings >> accessibility >> magnify mode >> OFF
    you can deactivate the "reset to Hub view" :
    hub >> overflow (bottom right button) >> Settings >> Display and actions >> Return to Default View When Idle >> OFF
    bunjamin wrote:
    my ringtone is much softer than it was previously
    yes, BlackBerry has acknowledged this bug in this article from the public knowledge base:
    KB36755 After upgrading BlackBerry 10 OS to version 10.3.1 the volume for notifications is noticed to be significantly lower than in the previous version
    The search box on top-right of this page is your true friend, and the public Knowledge Base too:

  • Swf is not working properly when upload to server

    I develop 1.swf which is having 3 buttons each one having
    anather .swf to call 2.swf, 3.swf respectively.
    This application is running perfectly on my PC, but
    While uploading the swf to server the 2.swf and 3.swf is
    not running. Can any one tell how to recover from this kind
    of problem.

    justbipin wrote:
    > basically my code working perfectly,
    > but its not working properly when upload to server
    > can anybody having any ref. or link to solve this
    issues.
    why is that we insist on seeing the source file ?
    There is no one way of doing things in flash and no one can
    help
    you based on "does not work description".
    This is way to broad of a subject to even try to guess.
    Same as asking "my car does not work, what's up with
    that"....
    Please upload the problematic file and provide url for us to
    check.
    Otherwise you need to try to troubleshoot it yourself as we
    can't
    guess from here what possibly is wrong with that file.
    Regards
    Urami
    Happy New Year guys - all the best there is in the 2006 :)
    <urami>
    http://www.Flashfugitive.com
    </urami>
    <web junk free>
    http://www.firefox.com
    </web junk free>

  • PDF file is not created properly when I choose File- Print...- PDF-- Save as PDF

    PDF file is not created properly when I choose File->Print...In dialogue box if i select option Save as PDF under PDF button...But it works fine with Safari Browser..
    == This happened ==
    Every time Firefox opened
    == always

    My first thought is to make sure the fonts used are common. If there is a substitution, things will be off.

  • Stationary credated in Mail does not appear properly when viewed in Outlook, is there aroundthis?

    Stationary credated in Mail does not appear properly when viewed in Outlook, is there around this? Or, can I export (as a PDF) the email drafted in Mail with stationary that does not have the meail info on top of the page . Thanks so much for your help.

    No real solution to problem 1, stationary tends to look different depending on the client, as for 2 Mail does not export to pdf but can print to pdf, however you still get the mail headers.

  • TS1630 My Iphone 4s reciever is not working properly, when i call someone from my iphone 4s.  can any one help me how to solve this problem?

    My Iphone 4s reciever is not working properly, when i call someone from my iphone 4s.  can any one help me how to solve this problem?

    You might like to define "not working properly".

  • Application does not work properly when I press a CommanButton

    Hi all, I am having a problem with weblogic 10.3.5.
    It turns out that an application built with JDeveloper 11.1.5, I test it, and everything goes well in the JDeveloper integrated Weblogic.
    But when deploy in a standalone weblogic 10.3.5 server, the application does not work properly when I press a CommanButton to go to another page search (the property "action" is set correctly) , but nothing happens, stays in the same home page. Similarly when a commanButton link to run a task-flow, It do not work , however in the JDeveloper integrated Weblogic it runs correctly.
    How I can solve these problems?
    Thanks.

    Thanks Frank for help us, but when I writing this comment we are doing at home. So, we going to test the page in a stand alone weblogic server 10.3.5. We wrote the URL as :
    " http://<our ip>:7001/myApp/faces/index.jspx "
    this application contains a report desing and compiled with iReport 4.5.1 ( last version in the moment ), we can see the report when I press a commanButton without any problem.
    But now, we need try your suggestions in the office, and give you more information about it . Thanks for the moment.
    In the Afternoon we gonna give you more information about it .

  • Icon image is not shown properly in LInux

    Hi,
    I am creating a JDialog as follows:
    JDialog jd = new JDialog(frame, true);
    in the frame, I have set the icon using
    frame.setIconImage(image),
    but the image set to this is not shown properly in Linux, but it is shown clearly in windows,
    can anybody show some light here.
    thanx,
    Raj

    I would put my money on the fact that since your application is timing out, it is dropping any state that your View Objects otherwise had before the application timeout.
    So upon reauthorizing and reaccessing the application (and going directly to the detail page) the View Object is reinstantiated and only knows to go to its default data set which is 111.
    If my assumption is correct, I don't think you could really implement this without a lot of trouble.

  • Flip Card Animation is not working properly when Button's PointOver State remain Activated.

     I am facing problems with flip car animation which is not working properly when its mouse point over state remains activated but it works perfect when its tapped two times and instantly change pointer position. Kindly Help me out as soon as possible.
    Code is here:
    Xaml:
    <Image Name="imgCapital" RenderTransformOrigin=".5,.5" Tag="1" Tapped="imgCapital_Tapped">
    <Image.Projection>
    <PlaneProjection RotationY="0"/>
    </Image.Projection>
    </Image>
    <Image Name="imgSmall" RenderTransformOrigin=".5,.5" Tag="2" Opacity="1" Tapped="imgSmall_Tapped">
    <Image.Projection>
    <PlaneProjection RotationY="-90"/>
    </Image.Projection>
    </Image>
    Storyboard:
    <Storyboard x:Name="FlipOpen">
    <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Projection).(PlaneProjection.RotationY)" Storyboard.TargetName="imgCapital">
    <EasingDoubleKeyFrame KeyTime="0:0:0" Value="0"/>
    <EasingDoubleKeyFrame KeyTime="0:0:0.4" Value="90"/>
    </DoubleAnimationUsingKeyFrames>
    <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Projection).(PlaneProjection.RotationY)" Storyboard.TargetName="imgSmall">
    <EasingDoubleKeyFrame KeyTime="0:0:0.4" Value="-90"/>
    <EasingDoubleKeyFrame KeyTime="0:0:0.8" Value="0"/>
    </DoubleAnimationUsingKeyFrames>
    </Storyboard>
    <Storyboard x:Name="FlipClose">
    <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Projection).(PlaneProjection.RotationY)" Storyboard.TargetName="imgCapital">
    <SplineDoubleKeyFrame KeyTime="0:0:0.4" Value="90"/>
    <SplineDoubleKeyFrame KeyTime="0:0:0.8" Value="0"/>
    </DoubleAnimationUsingKeyFrames>
    <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Projection).(PlaneProjection.RotationY)" Storyboard.TargetName="imgSmall">
    <SplineDoubleKeyFrame KeyTime="0:0:0" Value="0"/>
    <SplineDoubleKeyFrame KeyTime="0:0:0.4" Value="-90"/>
    </DoubleAnimationUsingKeyFrames>
    </Storyboard>

    Actually i simply want flip card animation which is not working here in my code. When i tapped button to invoke animation its behavior not exactly flipping.  Its one side work properly but other collapsed suddenly not rotate if i keep mouse right at
    the button, but if i change mouse pointer at that very time after tapping it works properly. Mouse Pointer Over mean screen points where i tapped.
    Triggered Function is here:
      private void btnChangCase_Tapped(object sender, TappedRoutedEventArgs e)
                if(isCaseChanged==false)
                    isCaseChanged = true;
                    FlipOpen.Begin();
                else if(isCaseChanged==true)
                    isCaseChanged = false;
                    FlipClose.Begin();

Maybe you are looking for