I am stuck using JideSoft at the momemnt. I have a DockableFrame, which will have many views on it. I want to hide the tabs that let me switch between views, but I cannot figure out how. Can anybody help?
User can right click on the tab or the title of DockableFrame to select close menu item to close it. If you refer to how to close it using API, DockingManager.hideFrame will do it.
DockableFrame.hideFrame(String frameName) works perfectly.
If you want to hide/unhide a component inside a DockableFrame you'll need to access that component, set the visibility
component.setVisibility(!component.isVisible());
and then ask the parent DockableFrame to revalidate itself.
parentFrame.revalidate();
Related
I have a pretty basic interface of a chromotagram viewer. In the menu I allow the user to reverse the viewer with a JCheckboxMenuItem. Functionally, it does exactly what its supposed to do. My interface allows for multiple chromatograms to be open at once. I will post a few example pictures as I get to my question.
Above I have one tab opened and have yet to reverse the chromatogram.
Above I have clicked the option and it worked.
Here is my issue. If I open another tab and move to it, the option is still checked even though I have yet to click that button. The easy way out would be just to make it a normal button but I just want to know if there is a way that each tabbed could keep track of if its been reversed yet. Would this require multiple instances of the button itself? If anybody has any suggestions, please let me know. Thank you.
if(centralPara.getNumOpen() > 1){
centralPanel = centralList.get(centralPara.getCurrentFrame());
JCheckBoxMenuItem reverseItem = centralPara.getReverseItem();
boolean reversed = centralPanel.getReversed();
reverseItem.setSelected(reversed);
}
in my tab change listener I check to see that we have atleast more than one tab open. if so get the frame we are currently viewing and the top level menu item. Force it be be selected if that the current view frame is selected, or else force it be unselected.
I'm using a dynamic graphic library to display data. By clicking with the left button on a node, a window pops out displaying info about it. I would like to use the right button instead, which by now is used to move the node around (without the window popping out). The problem is: the graph listeners I'm using only respond to the left button. So the only solution I can think of is to swap the mouse buttons mapping on the java application. Is there a way to achieve this?
I might be wrong, but can you use MouseListeners for right click, and than use java.awt.Robot to left click that? just a thought. good luck.
Whoops, sorry. I already solved this a long time ago and I forgot to post the answer: The library I'm using is graphstream, and I just needed to set the graph DefaultMouseManagerm (with overriden functions) which takes care of mouse clicks on the graph.
I'm trying to add a ColorPicker to my app. I see a lot a of ColorPickers (the one frome the API'S Samples, the one from Cyanogen, the AmbilWarna library, the HoloColorPicker, and the ColorPickerPreference). I think that the best for my app is the last one, but I don't need to use it on a preference.
So, what I want is to use this library inside my project when I click a button, and then take the resulting code from the SharedPreferences(I think, I don't know it), and use that color as I want for my app.
I try to use only some of the classes (only ColorPickerDialog, ColorPickerView, ColorPickerPanelView and AlphaPatternDrawable) and then I think that I have to do:
ColorPickerDialog dialog = new ColorPickerDialog(Main.this, Color.BLACK);
dialog.show();
And now I don't know how can I have the selected color.
Also I added to my project the xml view.
Any idea?
To know what is the selected color you need to to:
color=dialog.getfinalColor();
So, I think that the problem was easy to solve it. But now the problem is find a listener to detect when the dialog is closed and then to save the variable "color".
I know I can add a ChangeListener to detect when the tab changed, but I would like to do it before it changed. Here's my situation:
when my user tries to switch tab I do a validation some content on the current tab and the tab should switch only if the validation passes. If I use addChangeListener and switch it back upon validation failure (hoping that it happens fast enough that I won't see it) I will see the tab switched and then immediately switched back which looks stupid.
Something within JTabbedPane is responding to tab click for sure that triggers a state change, I just wonder if this functionality is exposed outside of the class. Either way, is there a good solution for this?
Thanks in advance
Here is a nice approach to do validation before switching tabs by creating a custom VetoableSingleSelectionModel:
Forbid tab change in a JTabbedPane
We are building our own Web Browser in Java. It doesn't have to be anything too complicated, we just want several things to do so we could distinguish our project from others.
What we want to know is this:
Is it possible to somehow embed a JTextField object into a JMenuItem?
To be more precise, we want our address bar (text field) to show when we click on a certain item within our menu.
Well, menu items are used for invoking an Action which causes the menu to close.
So you would just have your menu item Action display a popup dialog or something like that.
Or, if you really want to keep the popup open, the you could probably create a sub menu and then just add the JTextField to the sub menu. Remember, you can add any Component to JMenu.
Or, if you just want the text field to display on the main menu, then you just add the text field to the main menu. Of course you would lose functionality like being able to use the keyboard to navigate up and down the menu list.
All the suggestions are a hack at best, so I agree with the original comment to your question.
It's done in the standard OS X "help" menu, so I wouldn't call it an interface "quirk".
A quick google turned up this old link from 2004:
http://coding.derkeiler.com/Archive/Java/comp.lang.java.gui/2004-12/0149.html