Moving object (like button, textfield ,label,.....)

if I have an object in the applet area like (button , textfield, label,....) and if I want to move the object buy simply click on the object and drag it to move it.
if someone a solution send to me on :
"[email protected]"

if I have an object in the applet area like (button ,
textfield, label,....) and if I want to move the
object buy simply click on the object and drag it to
move it.
if someone have a solution send it to me on :
"[email protected]"

Similar Messages

  • Moving Objects On Button Click

    i was just woundering how to make an object e.g. (Rectangle Block) move on the click of a button
        private void btn_MoveLeftMouseClicked(java.awt.event.MouseEvent evt) {
            //move left
        }Thanks Rich

    1) how to make an object move
    2) how to capture button events
    3) how to invoke the object-moving code from
    event-capturing code4) Don't assume that whatever you painted somewhere can be picked up and modified. You can't do that with a real piece of paper, either. You need to draw it again from the start.

  • How to insert a component (like button, textfield) onto a panel ?

    i have a toolbar where i have used image icons for various controls...now, on click of a particular icon, i want to display the corresponding component...for eg, if i click a buttonimageicon, i want to display Button component on the panel...what should my actionperformed method look like? kindly help me....

    panel.add(new JButton("test"));

  • Moving object maintenance....

    HI...
    FOR  I WANT TO KNOW THAT HOW MAINT. WORK  IS CARRIED OUT FOR MOVING OBJECT LIKE FORK TRUCK. WHERE THERE IS NO FIXED LOCATION FOR THIS TYPE OF THE OBJECT AND NOT INSTALLED AT ANY PARTICULAR LOCATION .
    THEN HOW WE CAN MAP THIS SCENARIO IN SAP-PM?
    Regards,
    Pravin

    hi
    you need to create as new equipment in IE31. and not to assign this to any location.
    for IMG goto
    Spro
    Plant Maintenance and Customer Service --> Master Data in Plant Maintenance and Customer Service --> Settings for Fleet Management
    Creating a Fleet Object as Equipment
    Logistics --> Plant Maintenance -->Management of Technical Objects --> Equipment --> Create (Special) --> Fleet Object.
    check this help link also
    http://help.sap.com/erp2005_ehp_03/helpdata/EN/32/d66bebfc7111d29ee40000e8323350/frameset.htm
    -ashok

  • Is there a "blur moving object" feature in Premiere Pro 2, like for pixelating a moving face?

    Is there a "blur moving object" feature in Premiere Pro 2, like for pixelating a moving face?
    When I went to post this question, I put "blur" in the tags, and it offered me a list of tags with the word "blur", including "path blur", which sounds like what I'm looking for, but I a did a search in the PDF manual for Premiere Pro 2, and it didn't find that anywhere.
    Thanks,
    digi

    There is no path option in PP2
    If the subject is moving you need to keyframe position over time yourself.
    Premiere - Blur Face - YouTube

  • Blur moving object in AE CS6

    Hi:
    I need to blur a moving object:
    - The effect is only needed at some point of the video, it must appear, and then disappear, not being on screen the whole time.
    - The object is moving, and changing shape, the blur must adapt to it.
    - I've been trying to use the "Track Motion" option with Position & Rotation, then the "Analyze Forward" button, but the thing makes a mess all over, it's not following the object at all, then if You try to adjust it manually, it's only done in 1 frame, in the other frames the thing is off the object, then the "Tracking" stays on screen.
    Thanks in advance.

    Are you saying that you have something in some video that you have shot that you want blurred out? If so, you could create an adjustment layer with a mask on it over the object you want to blur and then just animate the mask over time. Now, you could use motion tracking to help that mask follow the object, but it sounds like you are having trouble with getting it to work properly. Try the tips here for doing motion tracking correctly. Alternatively, you could follow the tips on rotoscoping to make the mask animation go more quickly. Also, if you have After Effects version 12 (also known as AE CC), you can use the new mask tracker feature.

  • Interlace problems with moving objects using iDVD

    I had an MP4 file (created by a 3rd party) from a Hi-8 analog tape which has some interlace artifacts on moving images (left image of boy) but not too bad. When the MP4 files was imported into iMovie 11 the interlace artifacts smoothed somewhat - that was OK (right image of boy). The camera was still and the boy was moving.  Vertical lines on stationary objects are OK in all images. These are screen captures from the Mac of the mp4 played through quicktime and the same file imported into iMovie 11 and played.  I paused both to take the screen capture.
    The completed project in iMovie 11 looked OK when previewed prior to rendering. These are 20 year old videos so my expections were being met.   I rendered the project with iDVD to the hard drive first and then to a DVD with the same poor imaging result on the moving object.  I am using a new Macbook Pro I bought in early January which came with iMovie 11 and iDVD  Ver 7.1.2 (1158). Running Mac OS X 10.7.3  Macbook Pro  2.3 Ghz Corei7   8GB 1333 Mhz DDR3.
    I couldn't screen capture from the MAC DVD player screen to illustrate the poor result (got a checkerboard screen) so I took a photo of the screen and imported that (below).  The moving boy on the left is from an  iMovie 11 screen capture, the image on the right is the moving boy from the rendered DVD I paused on the Mac (and took a pic of).
    Below a close up of the poorly rendered moving boy viewed on the resultant DVD.  This translates into a horrible rendition of any quick moving object.  It happens with any moving image - i.e. a pan across a room with straight vertical lines like edges of a wall will show as serrated and poorly rendered edge. I used a trial version of the Daniusoft DVD creator with the same result!  I am at a loss on how to resolve this issue.  Any thoughts out there??
    I had previously used Pinnacle Studios on my old XP PC which worked great on other tape's Mpeg files and created great DVD's (never had an interlace problem) ... until my computer died .....  so I figured Apple and associated software should be at least equal if not a superior product.   Now I'm not too sure!

    I had an MP4 file (created by a 3rd party) from a Hi-8 analog tape which has some interlace artifacts on moving images (left image of boy) but not too bad. When the MP4 files was imported into iMovie 11 the interlace artifacts smoothed somewhat - that was OK (right image of boy). The camera was still and the boy was moving.  Vertical lines on stationary objects are OK in all images. These are screen captures from the Mac of the mp4 played through quicktime and the same file imported into iMovie 11 and played.  I paused both to take the screen capture.
    The completed project in iMovie 11 looked OK when previewed prior to rendering. These are 20 year old videos so my expections were being met.   I rendered the project with iDVD to the hard drive first and then to a DVD with the same poor imaging result on the moving object.  I am using a new Macbook Pro I bought in early January which came with iMovie 11 and iDVD  Ver 7.1.2 (1158). Running Mac OS X 10.7.3  Macbook Pro  2.3 Ghz Corei7   8GB 1333 Mhz DDR3.
    I couldn't screen capture from the MAC DVD player screen to illustrate the poor result (got a checkerboard screen) so I took a photo of the screen and imported that (below).  The moving boy on the left is from an  iMovie 11 screen capture, the image on the right is the moving boy from the rendered DVD I paused on the Mac (and took a pic of).
    Below a close up of the poorly rendered moving boy viewed on the resultant DVD.  This translates into a horrible rendition of any quick moving object.  It happens with any moving image - i.e. a pan across a room with straight vertical lines like edges of a wall will show as serrated and poorly rendered edge. I used a trial version of the Daniusoft DVD creator with the same result!  I am at a loss on how to resolve this issue.  Any thoughts out there??
    I had previously used Pinnacle Studios on my old XP PC which worked great on other tape's Mpeg files and created great DVD's (never had an interlace problem) ... until my computer died .....  so I figured Apple and associated software should be at least equal if not a superior product.   Now I'm not too sure!

  • I do not see ANY of the new features claimed for Firefox 4, and moving the home button all the way to the right is very inconvenient. So what's so great?

    I have used (and liked) Firefox from the first time it was offered. I
    typically upgrade to newer versions as they come out. Sometimes
    the newer version doesn't differ markedly from the previous one, but, until now, they were not usually a step backward. Upon installing Firefox 4 the welcome page indicated several new features. Specifically an app bar, and a bookmark button next to the home button. However neither of these features are on my copy of the program. Frankly, the only change that I see is the new position of the home button; and I don't like it. Moving the home button all the way across the page from the other commonly used buttons makes absolutely no sense to me, especially if the touted bookmark button doesn't exist. The new speed, if it continues, is nice, but other than that I see no real improvement over Firefox 3. So what's so great?

    The new interface is only default on Windows Vista and Windows 7. To get it on Windows XP you need to hide the menu bar. To do that in the View menu select Toolbars, then click on the "Menu Bar" entry.
    If you need access to the menus you can press either Alt or F10 to temporarily display them.
    You can rearrange the buttons and place them where you want, for details on how to do that see https://support.mozilla.com/kb/how-do-i-customize-toolbars

  • How to deal with moving around like in gta2?

    Hi there,
    I'm programming an game but i was wondering how to deal with moving around like in gta2.
    my game is also top-down with you(tha player) constantly in the middle of the screen. I know how to deal with button press etc.. but how to calculate how manny pixels the map has to move in the x and y axis...
    It's difficult to explain for me.. but hope the picture is clear..
    greetings

    I was afraid for this one already.. the picture is not clear:) thanx for your response so far.. I will try again.. with the game gta2 in mind:)
    see this screenie: http://www.vollversion.de/bilder/705_1_full.jpg
    My game looks the same as gta2 top down... with the character in the middle of the screen(the one firing the flame thwower )(the player). if i press up he walks towards the police car.. if i press left or right.. he only turns around(an combination of pressing up and left is also posible) thus the character walks in the direction he's facing.
    Now i would like to know how did they do this? how to programm such a movement? Because the character is standing constnatly in the middle of the screen the map has to move like in almost every game... how to calculate the x and y axis movement of the map?
    Please.. try agian.. hopefully the screenie will help.

  • How do you filter out moving objects in a movie?

    Hello!
    I'v searched the internet for solutions to this but I cann't find any.
    Im prittie new and I need to make a house on fire while two guys (one is me)
    will be walking away from it, towards the camera.
    I want to filter out these two guys and only apply fire and flames to the house itself!
    To do this I used Time Diffrence and tried to isolate the guy using Fast Blur and Luma Key
    but Im prittie lost.. Nothing works and I really need guidence
    Do you know a trick to use?
    I cant do greenscreening as the green background would cost a fortune..
    But isn't there anyway to filter out moving objects?

    I'm not sure that you totally get the process. This kind of shot requires at least 3 elements or plates. These three plates become three layers in After Effects. The bottom layer would be the Background Plate which is a shot of the house without any actors in the shot. The next plate would be the Effect Plate or Fire Plate which could be any shot you can get or generate through plug-ins of flames. The top layer would be your Foreground Plate or your two actors.
    Now that you know what you need you can plan your shoot. The background plate is easy. Just set the camera on a tripod and lock it off. NO zooming. No panning, No change of focus. The foreground plate is also easy. You don't have to green screen the entire set, all you need to do is to put a green screen behind your actors. I do this kind of thing all the time using a 6' X 6' (sometimes smaller) green screen (or blue or red or purple) made of fabric and stretched over a frame that I made from 1/2" EMT electrical conduit and 4 90º elbow connectors for less than $20 at Home Depot or Lowes. You get a couple of assistants to walk behind your actors holding the green screen behind them. If you need to include their feet they can be easily rotoscoped out later and you can garbage matte everything else. If it's impossible to green screen the shot then you are stuck with roto, but that's much easier in CS5 using the roto brush. If you use your show with the actors as the background plate roto is even easier because you can hide a multitude of sins by simply feathering the roto and letting the fire light wrap around the actors a bit.
    The fire plate can be purchased footage, or you could shoot a real fire against a black background, or you could create the flames using AE or even a 3D app like Blender (free) or a bunch of other apps.
    Making the shot look real requires a few tricks once you have your clean plates. Fire creates light so you've got to add lighting effects to the background plate to sell the fire. You've also got to wrap light around your actors. Look for tutorials on light wrap for this. You can really help sell the effect if you place some flickering light sources behind and to the side of your actors when you shoot the foreground (actors) plate.
    Once you get a handle on these techniques it's fairly easy to make the transition to pulling of this kind of a shot with a hand held camera (now you have to learn motion tracking). On a project I recently completed we had to put a fire in a prop fireplace while actors moved around bringing milk and cookies for Santa. It was all roto and the fire was shot at night with nothing more than a black cloth (Duvetyne) behind the fireplace grate. The final composite was 10 layers and was so totally believable that no one questions the shot.
    The layers were from top to bottom, reflection in grandmas glasses, light wrap, actors (roto of original background plate), fire flicker layer, color mask layer (more orange around fire, fire glow layer, fire layer in Add mode, second fire layer in screen mode, third fire layer Luma keyed, and finally the original plate which contained all the actors, carefully lit with flickering firelight simulated by dangling a stick with fabric cut into 1/2 inch wide strips about one foot long in front of a orange gelled light behind and to the right of  the actors.
    If I get a chance I'll post a screenshot.
    Here you go:
    Light Wrap:
    The Movie
    Part of the original render before color grading.
    Enjoy

  • Moving objects from USERS tablespace

    Hi All,
    I want to clean my database and this involves moving all objects from USERS tablespace to their respective tablespaces. I have following types of objects in my database:
    INDEX
    INDEX PARTITION
    INDEX SUBPARTITION
    LOBINDEX
    LOBSEGMENT
    TABLE
    TABLE PARTITION
    TABLE SUBPARTITION
    Syntax of moving TABLES and INDEXES is pretty simple. But, since there are other objects like TABLE PARTITION, INDEX PARTITION etc. Can anybody help me in finding out what are the syntax of all the above objects movement?
    Thanks,
    Danish
    Edited by: Danish on Dec 5, 2008 5:19 AM

    Hi..
    You need to use the SUBPARTITION <name> instead of PARTITON<name>
    For partition
    ALTER TABLE parts MOVE PARTITION abc TABLESPACE xyz parallel (degree 2);
    For subpartition
    ALTER TABLE parts MOVE SUBPARTITION def TABLESPACE xyz PARALLEL (DEGREE 2);
    This is because every segment represents one and only one type of database object,such as a table, a partition of a partitioned tables etc.For partitioned table , every partition resides in its own segment.
    Anand
    Edited by: Anand... on Dec 5, 2008 5:20 PM

  • Action: can a Connection Line follow the moving objects

    Dear members of this forum,
    I am currently discovering the possibilities of Apple Keynote, and I find it very interesting. I just registered and would like to ask my first question.
    Using "Connection Line" I can connect two objects (like two rectangles), and in this way, I can move these objects when changing my slide without worrying about the line ending up in the wrong place.
    But what if I want to use animations and let those objects move during the presentation? I cannot find any way to force Keynote to make the endpoints move along?
    Do you have any suggestions?
    Many thanks!

    Seems my last post got cut off at the bottom. Here is the rest:
    When you select the second action, you will get the option to have it happen Automatically with build 1. Then do the same for the third action. The result will be all three objects moving at the same time to where ever you told them to move to.
    As for grouping two objects and a connecting line, I don't think that you can do that within Keynote. What you can do though is select all three objects and copy them. Then open Preview and command n +(or File>Get new from Clipboard)+, copy and paste back into Keynote. Basically it turns the three individual objects into one pasted .pdf. The problem is you can not edit each individual object then. The plus size is it allows you to add a scale action along with the move if you want and you don't have to worry about the connecting line not connecting anymore.

  • Multi-line toggle button bar labels?

    I am trying to do a grid of buttons where only one button in a row can be "pressed".  Seems, based on suggestions here as well, the easiest way is one togglebuttonbar per row of a grid.
    Anyway, I need to have taller buttons with a few lines of text in each label (button).  Think of a table where the cells are selectable.
    I found a way to extend a simple button's label to make it multi-line, but not sure on how to do this for a togglebuttonbar:
    package tools
    import flash.text.TextFieldAutoSize;
    import mx.controls.Button;
    import mx.core.mx_internal;
    use namespace mx_internal;
    public class MultilineButton extends Button {
    public function MultilineButton()
    {super();}
    override protected function createChildren():void
    super.createChildren();
    textField.multiline = true;
    textField.wordWrap = true;
    textField.autoSize = TextFieldAutoSize.LEFT;
    override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void {
    super.updateDisplayList(unscaledWidth, unscaledHeight);
    textField.y = (this.height-textField.height)>>1;
    And then I call it with <t:MultilineButton label="four score and seven years ago" width="150" height="150" textAlign="left"/>
    Should I just use this single button in a Repeater?  Or is there a way to work with the togglebuttonbar?

    I tried that, I guess I am doing it wrong since it is still doing centered
    and bold:
    package tools
    import flash.text.*;
    import mx.core.mx_internal;
    use namespace mx_internal;
    public class MultilineToggleButtonBar extends ToggleButtonBar
    public function MultilineToggleButtonBar()
    super();
    override protected function createChildren():void
    super.createChildren();
    textField.multiline = true;
    textField.wordWrap = true;
    textField.autoSize = TextFieldAutoSize.LEFT;
    var format:TextFormat = new TextFormat();
    format.bold = false;
    format.align = "left";
    textField.defaultTextFormat = format;
    override protected function updateDisplayList(unscaledWidth:Number,
    unscaledHeight:Number):void {
    super.updateDisplayList(unscaledWidth, unscaledHeight);
    textField.y = (this.height-textField.height)>>1;

  • Place an object like Illustrator does.

    Hi. I need a way for Photoshop to place an object like Illustrator does. Sure, Smart Objects are nice but I need a method where I have a PS file and 1 or more layers in it are referenced. When these references are updated the PS file should update automatically (yes, I will have to have the file open and save ...). Illustrator does this ... page layout apps do this. I need for PS to do this or find a work method that will help do this. Any thoughts?
    The specific details:
    We have several hundred images of our app's interface. The images are composites of generic interface and language-specific interface. To make things easier when updating or translating docs we snag the local parts of the interface.
    We would then place and align the separate images in FrameMaker. We're moving to a new tool and output and we need to put all of the images together in a single image file but want to retain the ability to only update the localized sections. Smart Objects are not smart when trying to do this as they require you to either (essentially) re-import the object (using Replace) or edit the object from the composite image. This obviates the ability to simply replace the target image and have the composite update.
    So ... any input? Thoughts? Ideas? I considered the possiblity of doing this from Illustrator but that is just so much more ... demanding.

    Yes one thought, but it's not perfect:
    I think this would require a Phoroshop Javascript which does the following:
    First, prepare the document: Each smartobject should be named like the actual file of it's original content, so the script knows where to look for changes, like "screenshots/shot1.jpg", "titles/title1.png" and so on.
    Second, the script:
    It should go through all smartobjects in the document and then check the file (which it gets by the name of the smartobject) and it's date.
    If it's newer than the document's last changed date, it should replace the content, otherwise just skip it.
    Well I don't know if the Photoshop Javascript is actually capable of things like that, but it can do a lot though and can be a big helper for everything batch-related

  • Adding menu-like buttons to JToolBar (such as Back button in Netscape)

    Hi,
    I wonder wether it is possible to add a menu-like button to a JToolBar. I tried adding a JMenu but didn't succed, since the menu's visual appearance was completely messed up and, furthermore, it didn't respond to mouse clicks.
    Any hints appreciated.
    Janek.

    To do that, I wrote 3 classes.
    At the end, the new menu reacts and can be used exactly as a JMenu.
    The first class is the menu class which extends JMenu :
    import javax.swing.*;
    * This class override the method boolean isTopLevelMenu() to
    * allow a menu to be a top level menu in a JMenuBar and a JTollBar also !
    public class MyMenu extends JMenu {
        public MyMenu() {
            super("");
        public MyMenu(String s) {
              super(s);
        public MyMenu(Action a) {
              super(a);
        public MyMenu(String s, boolean b) {
            super(s,b);
         * Returns true if the menu is a 'top-level menu', that is, if it is
         * the direct child of a menubar.
         * @return true if the menu is activated from the menu bar;
         *         false if the menu is activated from a menu item
         *         on another menu
        public boolean isTopLevelMenu() {
            if (getParent() instanceof JMenuBar  || (getParent() instanceof JToolBar))
                return true;       
            return false;
    }The second class extends JToolBar. It is necessary to redefine the MenuBar behavior : When a menu is pressed, you can move the mouse over the other menus and they will open themselves, etc... So the toolbar must implements the interface MenuElement
    import java.awt.*;
    import javax.swing.*;
    import java.awt.event.*;
    import java.util.*;
    * This class implements MenuElement to obtain the same behavior
    * as a JMenuBar.
    public class MyToolBar extends JToolBar implements MenuElement {
         public MyToolBar() {
              super();
         * Implemented to be a <code>MenuElement</code> -- does nothing.
         * @see #getSubElements
        public void processMouseEvent(MouseEvent event,MenuElement path[],MenuSelectionManager manager) {
         * Implemented to be a <code>MenuElement</code> -- does nothing.
         * @see #getSubElements
        public void processKeyEvent(KeyEvent e,MenuElement path[],MenuSelectionManager manager) {
         * Implemented to be a <code>MenuElemen<code>t -- does nothing.
         * @see #getSubElements
        public void menuSelectionChanged(boolean isIncluded) {
         * Implemented to be a <code>MenuElement</code> -- returns the
         * menus in this tool bar.
         * This is the reason for implementing the <code>MenuElement</code>
         * interface -- so that the menu bar can be treated the same as
         * other menu elements.
         * @return an array of menu items in the menu bar.
        public MenuElement[] getSubElements() {
            MenuElement result[];
            Vector tmp = new Vector();
            int c = getComponentCount();
            int i;
            Component m;
            for(i=0 ; i < c ; i++) {
                m = getComponent(i);
                if(m instanceof MenuElement)
                    tmp.addElement(m);
            result = new MenuElement[tmp.size()];
            for(i=0,c=tmp.size() ; i < c ; i++)
                result[i] = (MenuElement) tmp.elementAt(i);
            return result;
         * Implemented to be a <code>MenuElement</code>. Returns this object.
         * @return the current <code>Component</code> (this)
         * @see #getSubElements
        public Component getComponent() {
            return this;
    }The last class and morer difficult is the MenuUI. In my implementation, I use the WindowsLookAndFeel, so I redefine the WindowsMenuUI to look like Windows.
    I give you my code also (please, imagine how difficult it was to write!) :
    import com.sun.java.swing.plaf.windows.*;
    import java.awt.*;
    import java.awt.event.MouseEvent;
    import javax.swing.plaf.ComponentUI;
    import javax.swing.plaf.basic.BasicMenuUI;
    import javax.swing.plaf.basic.BasicGraphicsUtils;
    import javax.swing.event.MouseInputListener;
    import javax.swing.*;
    * Windows rendition of the component.
    * <p>
    * <strong>Warning:</strong>
    * Serialized objects of this class will not be compatible with
    * future Swing releases.  The current serialization support is appropriate
    * for short term storage or RMI between applications running the same
    * version of Swing.  A future release of Swing will provide support for
    * long term persistence.
    public class MyWindowsMenuUI extends WindowsMenuUI {
        private boolean isMouseOver = false;
         private int shiftOffset = 0;
         private int defaultTextShiftOffset = 1;
        public static ComponentUI createUI(JComponent x) {
              return new MyWindowsMenuUI();
         * Draws the background of the menu.
         * @since 1.4
        protected void paintBackground(Graphics g, JMenuItem menuItem, Color bgColor) {
              ButtonModel model = menuItem.getModel();
              Color oldColor = g.getColor();
            int menuWidth = menuItem.getWidth();
            int menuHeight = menuItem.getHeight();
              UIDefaults table = UIManager.getLookAndFeelDefaults();
              Color highlight = table.getColor("controlLtHighlight");
              Color shadow = table.getColor("controlShadow");
              g.setColor(menuItem.getBackground());
              g.fillRect(0,0, menuWidth, menuHeight);
              clearTextShiftOffset();
            if(menuItem.isOpaque()) {
                if (model.isArmed()|| (menuItem instanceof JMenu && model.isSelected())) {
                        // Draw a lowered bevel border
                        g.setColor(shadow);
                        g.drawLine(0,0, menuWidth - 1,0);
                        g.drawLine(0,0, 0,menuHeight - 2);
                        g.setColor(highlight);
                        g.drawLine(menuWidth - 1,0, menuWidth - 1,menuHeight - 2);
                        g.drawLine(0,menuHeight - 2, menuWidth - 1,menuHeight - 2);
                        setTextShiftOffset();
                   else
                   if (isMouseOver() && model.isEnabled()) {
                        // Draw a raised bevel border
                        g.setColor(highlight);
                        g.drawLine(0,0, menuWidth - 1,0);
                        g.drawLine(0,0, 0,menuHeight - 2);
                        g.setColor(shadow);
                        g.drawLine(menuWidth - 1,0, menuWidth - 1,menuHeight - 2);
                        g.drawLine(0,menuHeight - 2, menuWidth - 1,menuHeight - 2);
                   else {
                        g.setColor(menuItem.getBackground());
                        g.fillRect(0,0, menuWidth, menuHeight);
              g.setColor(oldColor);
         * Method which renders the text of the current menu item.
         * <p>
         * @param g Graphics context
         * @param menuItem Current menu item to render
         * @param textRect Bounding rectangle to render the text.
         * @param text String to render
         * @since 1.4
        protected void paintText(Graphics g, JMenuItem menuItem, Rectangle textRect, String text) {
              ButtonModel model = menuItem.getModel();
              FontMetrics fm = g.getFontMetrics();
              int mnemonicIndex = menuItem.getDisplayedMnemonicIndex();
              // W2K Feature: Check to see if the Underscore should be rendered.
              if (WindowsLookAndFeel.isMnemonicHidden()) {
                   mnemonicIndex = -1;
              Color oldColor = g.getColor();
              if(!model.isEnabled()) {
                   // *** paint the text disabled
                   if ( UIManager.get("MenuItem.disabledForeground") instanceof Color ) {
                        g.setColor( UIManager.getColor("MenuItem.disabledForeground") );
                        BasicGraphicsUtils.drawStringUnderlineCharAt(g,text, mnemonicIndex, textRect.x, textRect.y + fm.getAscent());
                   else {
                        g.setColor(menuItem.getBackground().brighter());
                        BasicGraphicsUtils.drawStringUnderlineCharAt(g,text, mnemonicIndex, textRect.x, textRect.y + fm.getAscent());
                        g.setColor(menuItem.getBackground().darker());
                        BasicGraphicsUtils.drawStringUnderlineCharAt(g,text, mnemonicIndex, textRect.x - 1, textRect.y + fm.getAscent() - 1);
              else {
                   // For Win95, the selected text color is the selection forground color
                   if (WindowsLookAndFeel.isClassicWindows() && model.isSelected()) {
                        g.setColor(selectionForeground); // Uses protected field.
                   BasicGraphicsUtils.drawStringUnderlineCharAt(g,text, mnemonicIndex,  textRect.x+getTextShiftOffset(), textRect.y + fm.getAscent()+getTextShiftOffset());
              g.setColor(oldColor);
         * Set the temporary flag to indicate if the mouse has entered the menu.
        private void setMouseOver(boolean over) {
              isMouseOver = over;
         * Get the temporary flag to indicate if the mouse has entered the menu.
        private boolean isMouseOver() {
              return isMouseOver;
        protected MouseInputListener createMouseInputListener(JComponent c) {
            return new WindowsMouseInputHandler();
        protected void clearTextShiftOffset(){
            shiftOffset = 0;
        protected void setTextShiftOffset(){
            shiftOffset = defaultTextShiftOffset;
        protected int getTextShiftOffset() {
            return shiftOffset;
         * This class implements a mouse handler that sets the rollover flag to
         * true when the mouse enters the menu and false when it exits.
         * @since 1.4
        protected class WindowsMouseInputHandler extends BasicMenuUI.MouseInputHandler {
              public void mousePressed(MouseEvent e) {
                   JMenu menu = (JMenu)menuItem;
                   if (!menu.isEnabled())
                        return;
                   MenuSelectionManager manager = MenuSelectionManager.defaultManager();
                   if (menu.isTopLevelMenu()) {
                        if (menu.isSelected()) {
                             manager.clearSelectedPath();
                        else {
                             Container cnt = menu.getParent();
                             if(cnt != null && (cnt instanceof JMenuBar || (cnt instanceof JToolBar))) {
                                  MenuElement me[] = new MenuElement[2];
                                  me[0]=(MenuElement)cnt;
                                  me[1]=menu;
                                  manager.setSelectedPath(me);
                MenuElement selectedPath[] = manager.getSelectedPath();
                if (!(selectedPath.length > 0 && selectedPath[selectedPath.length-1] == menu.getPopupMenu())) {
                        if (menu.isTopLevelMenu() || menu.getDelay() == 0) {
                             MenuElement newPath[] = new MenuElement[selectedPath.length+1];
                             System.arraycopy(selectedPath,0,newPath,0,selectedPath.length);
                             newPath[selectedPath.length] = menu.getPopupMenu();
                             manager.setSelectedPath(newPath);
                        else {
                            setupPostTimer(menu);
              public void mouseEntered(MouseEvent evt) {
                   super.mouseEntered(evt);
                   if (!WindowsLookAndFeel.isClassicWindows()) {
                        setMouseOver(true);
                        menuItem.repaint();
              public void mouseExited(MouseEvent evt) {
                   super.mouseExited(evt);
                   if (!WindowsLookAndFeel.isClassicWindows()) {
                        setMouseOver(false);
                        menuItem.repaint();
    }This UI simulate also the rollover effect.
    And now here is a class to test this code (under 1.4 and Windows L&F):
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import javax.swing.plaf.basic.*;
    public class MenuToolBar extends JFrame {
         public static String windowsUI = "com.sun.java.swing.plaf.windows.WindowsLookAndFeel";
         public MenuToolBar() {
              super("Menu toolbar");
              setWindowsLF();
              addWindowListener(new WindowAdapter() {
                   public void windowClosing(WindowEvent e) {
                        System.exit(0);
              setBounds(312,250,412,200);
              MyMenu menu = new MyMenu("File");
              MyMenu menu2 = new MyMenu("Help");
              menu.add(new JMenuItem("Try"));
              MyToolBar tb = new MyToolBar();
              tb.firePropertyChange("JToolBar.isRollover", false, true); 
              tb.add(menu);
              tb.add(menu2);
              JToggleButton jt = new JToggleButton("Toggle button", new ImageIcon("tog.gif"));
              jt.setFocusPainted(false);
              tb.add(jt);
              tb.addSeparator();
              JButton jb = new JButton("Button", new ImageIcon("but.gif"));
              jb.setFocusPainted(false);
              tb.add(jb);
              getContentPane().add(tb, BorderLayout.NORTH);     
              setVisible(true);
         public static final void setWindowsLF() {
              try {
                   UIManager.setLookAndFeel(windowsUI);
                   UIManager.put("MenuUI", "MyWindowsMenuUI");
              catch (Exception exc) {
                   System.err.println("Error loading L&F: " + exc);
         public static void main(String[] args) {
              new MenuToolBar();
    }Execute that, to see if the result is OK for you!
    Another thing : could you please report my name if you use and distribute the code ?
    Tell me if this helps you!
    Denis
    [                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

Maybe you are looking for