I'm creating two menu bar 1st menu bar is for background color & 2nd is for text color.the application contains text component where user can type text.when user press either of menu scroll bar are shown on screen.for red,blue,green, color component the user can adjust the position of scroll bar,on pressing "OK" button the foreground or background of text component on frame changes according to the menu choice.
One possibility is to create an MDI (one parent window, with an internal child window for each document). See: How to Use Internal Frames. The JDesktopPane and each JInternalWindow can have their own menus.
Two menus bars sounds awkward. Usually a single menu bar is more than enough to handle. Have you considered a popup menu instead for the second set of menus? If you still insist on adding multiple menu bars to a frame, consider changing their position for example use BorderLayout.SOUTH on one of them.
Related
How can I make the custom menu of close/minimize/maximize act like the default one ?
The Default menu can be docked on the right/left of the screen like split the screen on two parts , is there a way to make that happen ?
The Default windows 10 menu picture :
How can I make the custom menu of close/minimize/maximize act like the default one ?
You create buttons and add an Action to each button.
for the "close" Action you would use the dispose() method on the frame
for the "minimize/maximum" Actions you would use the setExtendedState(...) method on the frame
normally when the menu button is pressed , the menu appears from the center bottom of the screen. Is there a way to make it appear from sides.
On Android 3.0 and higher, items from the options menu are presented by the action bar which is standard way to provide access to menus and normally menus appears from top right corner. You should go through this once:
Menus Action Bar
How to remove or hide the left side Drop Down Menu only on jinternal frame Title Bar and not to remove or hide whole Title Bar.
How to set not Move jinternal frame by mouse holding in jdesktop pane.
Check below snapshot for better understand my question what I want:
http://i49.tinypic.com/1zfned2.jpg
As far as I know, the only way is to use your own UI delegate for the internal frame. See http://today.java.net/pub/a/today/2007/02/22/how-to-write-custom-swing-component.html for an article explaining how UI delegates work.
Since you seem to use the Synth look n' feel, you should be able to easily create your own subclass of SynthInternalFrameUI, that would override the createNorthPane() method in order to create and return an instance of a custom subclass of SynthInternalFrameTitlePane.
This custom title pane would in turn override the addSubComponents() method in order to not add the menuButton. I've not tested all that, so maybe you'll need to override additional methods.
1. how to remove or hide the left side Drop Down Menu only on jinternal frame Title Bar and not to remove or hide whole Title Bar. source code:
BasicInternalFrameUI ui = (BasicInternalFrameUI)internalFrame.getUI();
Container north = (Container)ui.getNorthPane();
north.remove(0);
north.validate();
north.repaint();
2. how to set not Move jinternal frame by mouse holding in jdesktop pane. source code:
for(MouseListener listener : ((javax.swing.plaf.basic.BasicInternalFrameUI) internalFrame.getUI()).getNorthPane().getMouseListeners()){
((javax.swing.plaf.basic.BasicInternalFrameUI) internalFrame.getUI()).getNorthPane().removeMouseListener(listener);
}
Thanks
Can someone give me advice on how can I the change tab (only in the tab itself, not the tab's content area) in JTabbedPane to an icon. It is possible to set another icon when the tab is selected, another icon on mouse over, and another icon when tab isn't selected. I'd like to have this icon on full tab width and height under the text, similar like when one replaces a whole button with an image.
Take a look at setTabComponent, this will allow you to supply a custom renderer for that tab
You would then need to monitor changes to the tab selection via the changeListener, when the tab changes, you would use the getTabComponentAt method to get the renderer and update it
I want to create a popup menu which has a few "big" (special) items.
These "big" items should somehow behave like submenus, but they are large panels (with buttons, labels, combo boxes, etc.). These panels should all appear when the mouse is over (or pressed at) the corresponding menu items, and they all should appear in the same screen area just next to the popup menu, beneath the topmost item entry, not aligned to their corresponding item). The last-selected of them can remain visible as long as the popup is visible.
Basically, I believe this feels like (A) putting a JLayeredPane next to the popup menu, and switching the layers according to some mouse events. Probably this would require to fake the whole popup menu using a single large JPanel inside a JPopupMenu having just this one entry (i.e. also all "ordinary" menu items would in fact have to be buttons.)
So, on the other hand (B), it seems probably smarter to use standard swing submenu items, add the big panels as submenu items, and then force all the submenu items to the same location and size. Though, I am not sure if this will work and whether there will be such problems like the menu getting instantly hidden as soon as the user clicks a combo box inside one of the big panels.
Would you recommend going for either (A) or (B) — or perhaps (C) ?
Any experiences / known pitfalls doing such things?
Kind regards,
Philipp
I don't have experience with A or B, but between the two I would try B first.
Another option that might be better is to use a JDialog. Set to to be undecorated and hide it when it loses focus. (This might just be an easier way to do A).