JFace CTabFolder, toggle between tabs - java

I'm working on an app in JFace. So I have a CTabFolder with a number of CTabItems in it. What I would like is to be able to automatically switch to display an arbitrary CTabItem.
What I'm thinking is something like:
CTabFolder myFolder = FolderFactory.newFolder();
myFolder.showItem(myFolder.getItem((ARBITRARY_INT)));
/*These don't help!*/
//myFolder.update();
//myFolder.pack();
//myFolder.redraw();
The folder works just fine by itself. i.e. users may tab through with the mouse. The difference is that I would like to be able to show different tabs by default in different perspectives.
Any thoughts?

You need to use CTabFolder#setSelection(..). The show item only shows the item, like if there are a lot of items and some are hidden, this method will scroll to them.

Related

Text color of MenuItem(System Tray)

I'm using System Tray and Menu Item to create a simple JFrame/tray application, and I was trying to colorize some of the menu item texts, I searched and looked at the API's, but just couldn't find anything that allows me to do that.
Is it even possible? If not, are there any available options for me to achieve this?

JavaFX CheckboxMenuItems / CustomMenuItems Trouble

I got CheckBoxMenu Items in a Menu to select filters I got. I found out that I can't use setHideOnClick on CheckBoxMenu so I used CustomMenuItem with a CheckBox inside, but now I can only click the box and its text to ckeck the box instead of the whole highlightened field. Is there any way to expand it to the width of the CustomMenuItem?
I got the same Problem like this:
JavaFX MenuItem without autohide
But the solution doesn't work 100% and in a comment there is the same question/problem I have now.
Greets

TabFolder with single item on OS X

I created a tab folder with one tabitem. When i execute this ui on mac it does not show me the title of tab item properly. If i create two or more tab item then its all titles are visible. I executed this code on windows there is not any problem with it.
I tried to search on google for the same but not have satisfied answer or solution.
If any body can solve this by giving proper justification.
Thanks.
Don't create a single-item tab folder or, if it really should look like a tab, try CTabFolder.

Alternative to Spinner? ( other ways to choose from a list?)

I want my users to choose something in one of my screen but i'm tired of the spinner. Can anyone suggest how can i add a cooler way to choose stuff?
If you're tired of a spinner, why not create your own styled dialog to select things. You can make it look however you want.
If you don't have too many options and/or they are labeled with short texts, you can consider using RadioGroup with radio buttons. This would of course go either directly on your activity (taking more space than a spinner) or inside a custom dialog.

JTable: how to select columns at runtime

I have too many columns in a table to display them all at once, and would like to let the user change which columns are visible. How can I do this?
note: It is easy to make the application select columns at runtime. What I am asking is what UI element(s) to add to allow the user to hide/unhide columns at runtime.
If you can import some external libraries, you could have a look to
http://swinglabs.org/docs/components/JXTable/tutorial.jsp which supports such runtime modifications.
Table Column Manager allows the user to right click on the table header to control which columns are visible.
There isn't a standard way, however what you could do is something like this:
Use a custom table header render component to install additional actions/UI on the column headers (e.g. through a context menu of checkboxes)
Add a custom model which you can re-configure to display different items depending on what the user selected through additional actions on the column headers
Do the event wiring/plumbing.
Alternatively: find a custom component that does this. There probably is something out there already: projects like the component library from JIDE would be a good place to look.
Use TableModel.addColumn(TableColumn) and TableModel.removeColumn(TableColumn) methods to show/hide columns on-the-fly.
You can attach that calls to any other GUI components (for example, make a JPanel or a JTable with a few checkboxes).
Either display a popup menu with the possible columns when user right-clicks the header or implement a small (and light) popup dialog with a checkbox list for selecting the visible columns. The dialog can be opened by right-clicking, by clicking a toolbar button or from a toolbar menu.

Categories