GUI on runtime differs from Designed GUI on NetBeans GUI builder - java

I am using JTabbedpane with a JPanel tabbed and all the components inside the panel are shown in the picture below:
This was, what I expected:
As given in below pic, the tabbed pane/panel is cropped, hence the buttons are not visible as designed in NetBeans.
This is, what I am getting:
Even when the GUI windows is maximized, it is still cropped as shown in below pic
Still looks same after maximizing the windows.
There's no additional code, I've written in GUI source code. And yet I am facing the issue.

Related

Swing Button has weird border

I have a blackjack game, and the GUI is created using swing. One of my buttons looks completely normal, and the other one has a weird border around the text. Both buttons were made using Intellij IDEA's built-in GUI form, and I copied the normal looking one to make the weird looking one.
Here's what the button looks like (compared to the normal one).
Can't embed images lol

swing output is to small in netbeans

look at the image and you will understand what my problem
that's happened in this computer which is 4k UHD
this problem was under netbeans itself but i fix it using netbeans-ide-scaling-on-windows-8-10
when i tried to test it under swing this problem appear again.
setSize and setFont(new Font(MAX_FONT_SIZE)) are not what i'm looking for.
my working environment is:
windows 10 home
netbeans v8.0.2
May be you are not preparing the dimension on jframe.
Go to the design panel and click jframe.
set the preferredSize, width, height to change the size of jframe on properties window.
I think that it will be work.

Java Swing GUI changing the LAF

I'm learning about making GUI using swing at the moment, and am getting frustrated trying to make a GUI for my application and making my own custom Look and Feel, using images. I have a Jframe which has a JPanel inside it(which is my application) I know how to add JmenuBar however i'm having trouble loading images to change the look and feel.
I'm trying to change the exit button, window button, and fullscreenbutton to image files and change the window bar of the application also.
Here is an example of what i'd like it to look like:
Any help on the subject would be most appreciated.

How to surround JTable with JScrollPane through windowbuilder?

In Eclipse Jigloo plugin you can right click on JTable and choose "surrond with JScrollPane".
But in windowbuilder pro plugin I can't find a way to make JTable with JScrollPane
Add a scroll pane to your UI. Then drag and drop the table onto the scroll pane. During the drag over scroll pane window builder will highlight its areas - make sure you drop onto the central one.
Alteratively the following also works nicely;
Add a JTable
Right click on the JTable in the tree view
Select: Surround With > JScrollPane
Another option would be to use NetBeans to do some of your Swing layout.
I've had limited experience with WindowBuilder, but I use NetBeans for designing prototypes and find it much easier for creating UIs. The resulting code generated from NetBeans will also be viewable using WindowBuilder.
I am using WindowBuilder 1.7.0 and Swing designer 1.7.0 in Eclipse in Mac. At first I was finding similar menu like Jigloo which I did not find. My Jigloo always crash in Mac and show license message, so I discarded it :)
Later with some playing, I found how to do it in WindowBuilder, specially if you have already designed the JTable/JTextArea/JTree and do not want to delete it. After that you need to put them scrollable.
You can use the tree view on the left. Normally you cannot drag a component into the scroll view. However add the scroll view in the frame. Set proper layout to the component where you want to put the scroll view. Usually its BorderLayout, may in a JPanel. Drag the JScrollView into target area. Use the tree view for all these actions. Then finally drag the JTree/JTable into the JScrollPane in the frame design view. To my experience this works better. Play with the Layouting of the parent components.

netBeans gui problem

I have designed this gui in netBeans which has a canvas , a couple of JtextAreas and a Jbutton. It looks great in preview, the problem is when I run the actual program the text areas are shurnk until the program prints something in them, then they expand to their full size, the Jbutton is invisible until I mouse over it then it stays visible, there is also a Jlabel which just doesnt show up in the program at all only in preview. I have designed one more program in netbeans before but did not have these problems. Any idea what I could be doing wrong?
No idea whats wrong, but you should NOT be using a Canvas. That is an AWT component and you should not be using AWT components in a Swing application.
Actually the Canvas could be the problem. AWT components are painted on top of Swing components which could be causing the problem. That might be why the mouse over forces the button to show through the Canvas. I've never mixed AWT/SWING components so I don't know what wierd painting artifacts you will encounter.

Categories