Change Default Buttons in Java to Make Them Look "Better" - java

I'm essentially trying to mimic the default windows xp simple calculator. When I change the background colours of the buttons in Java it makes them look very flat and "boring". I want to make the buttons look as close as possible to the buttons in the Windows XP calculator.
Here is an image comparing mine to WinXp's:
Is there some kind of method I can use to change the style of the buttons much like you can do in Visual Basic to make the buttons almost pop more or look 3D like the Windows Xp Calculator.
The default buttons in Java are sort of what I'm looking for except there not white there more of a blue kind of colour in a gradient.
Is this possible, or am I stuck with ugly button?

Try setting the system look and feel at the beginning of the main method:
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
This will load all Swing widgets with a native-ish look.
If you are insterested in what you are actually doing with this command, Oracle has a nice tutorial regarding look and feels: http://docs.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html

Related

How to change the color of the Title bar when running a GUI program?

I want to change the color of the title bar and also the Java icon on the upper left of the frame, so I can make my program (GUI) look better. Is there a simple way to change it?
I'm not sure how useful this observation is, but under the X Window System (e.g. on Linux), the titlebar and the icons in it aren't usually under the control of the application, they're “decorations” under the control of the window manager (WM). I'm not sure exactly how this might impact a Java program — they might be able to use undecorated windows and add their own equivalent — but it's equally possible that what you want to do simply isn't possible (without an inordinate amount of effort) on any platform.

Java - Image Opacity

I have been making a video using pure Java. I would like to put in a pop-up menu for players when every they hit ESC. I have the menu setup but it looks really quite ugly. I would like to make the menu blur the image behind it.
For example on the new iOS 7 on Apple devises a lot of the things like the dock blur to whatever is behind it. There is an example of what I am trying to achieve below!
The simplest solution would be to use something JXLayer, as it will allow you to apply filter effects to the components that it covers.
For example.

How to make "pages" in a java program

I have a question.
I just started with Java and may have some small basic things. Now I wonder how a kind of pages (sections) in a program makes.
I do not mean some kind of tabbed panel, or if you click on a button that a text is visible.
I mean that for example all over the screen a separate part of the program looks. As the main menu of a game.
There is nothing else than the main menu visible at that time. If you for example a button from that menu click. The game is loading.
(I'm using the building of a standard game as an example)
If you for example the main menu click on another button (eg "Settings")
Then wort settings "page" is visible, and there is nothing else that the program is really doing.
I do not know how this type of navigation is called. But almost every program does have something.
How can I do this too? What should I do for example, as a new file, import the classes of a particular page, or something?
You seem to be searching for CardLayout. As shown here.
I think you should look for "state machines", which is a way for structuring your code, and implement your menu changing swing components (like JPanel, for example) in a JFrame. If I understand what you want, I think this can be an option.
There is no short answer, but based on your question, you need to read alot. I would suggest the swing tutorial It explains use of Panels, Frames, Layout managers and other containers.
You can also use the Matisse builder in netbeans (relevant plugin in eclipse)

Is it possible to remove the little dropdown arrow in a JInternalFrame?

I'm using a JInternalFrame and I want to remove the dropdown in the upper left of the frame, as it serves no purpose (I've disabled resizeable, closable, etc.)
I don't see a property for this, and I don't want to remove the entire title bar, as the title is necessary. I've looked around online, and basically come up empty here. I'm hoping it's something simple that I've just overlooked, as this is my first time using JInternalFrame, and I'm not exactly a GUI kind of guy to begin with.
internalframe.setFrameIcon(null);
Edit: hack to remove system menu in Windows:
BasicInternalFrameUI ui = (BasicInternalFrameUI)internalFrame.getUI();
Container north = (Container)ui.getNorthPane();
north.remove(0);
north.validate();
north.repaint();
The relevant Icon in The Synth Look and Feel, among the Nimbus Defaults, appears to have this key:
InternalFrame:InternalFrameTitlePane:"InternalFrameTitlePane.menuButton".icon
You may be able to use the approach shown in A Synth Example to replace the Icon.
setFrameIcon(anyBigImageThatCantBeDisplayed);
I´ve tried null parameter and got some visual issues...
So i added a big image(no background) that was already on my resource folder and the icon was no longer displayed as the menu...

What equivalent in MIDP programing to the JButton of swing-application?

In swing(GUI) application I used JButtons.
Now I need the same application in MIDP and I'm conuse...
I need Idea for what to use with and an example of how to use it and what kind of listener might possible fits.(Because I need to refresh the shown screen after every click on a button)
And one more question: I use Netbins with the simulator of cell-phone.The screen is very tiny,
so is there any way to make this screen larger,In case I need to show something too width?
Lets say,something like 11-15 buttons...
I don't think there's anything that's exactly equivalent to a JButton, but I think you could solve your problem by implementing a Command though. I found a lot of examples:
MIDP Programming with J2ME (This one is a bit long. It's actually an entire chapter from a book and the Command example starts on page 4.)
Enterprise J2ME: developing mobile Java applications (Also a book, but I linked to the relevant section.)
J2ME Programming (Part I) (I like the CommandProcessor.java code example in this one.)
Visual Mobile Designer Custom Components: Creating Login Screens
Add Command to MIDlet (This one has the shortest and clearest example code, but it unfortunately doesn't have a screen shot of the final result.)
And one more question: I use Netbins with the simulator of cell-phone.The screen is very tiny, so is there any way to make this screen larger,In case I need to show something too width? Lets say,something like 11-15 buttons...
There is a way to choose an emulator with larger size screen. Last time I checked, Netbeans documentation had instructions on how to do that.
Though, before doing so, I would recommend you to find out whether the real device you're targeting will have such a screen. Because if its screen will be as tiny as the default emulator then your UI might look totally different from what you designed with large size emulator.
Take for example 11-15 buttons you mention - do you expect real device to have screen large enough to display these conveniently for user?

Categories