Netbeans Java Swing Components undragable - java

I am trying to learn Java Swing with the aid of the Netbeans IDE. Following this tutorial, I find myself stuck when I try adding a Panel to a JFrame.
The Panel, or any other component from the Swing Container, does not add to my design view.
I have tried dragging and right-clicking the component without success.
When I right-click the Panel component, I get various menu options including "paste item" but it is greyed out and inactive.

Just click on the palette "Swing Containers" Panel button. In 7.2 and 7.2.1 it is a toggle switch. Then go to your JPanel and you will see your new JPanel moving along with your cursor. Move it to the location you want to have it and click again. Then you can resize it to the dimensions you like...
Netbeans IDE is an excellent production tool. If you are in the learning phase however, it is always better to avoid using powerful GUI-editors, in order to gain a better understanding of the concepts. You can do that using simple text editors.
You will find these links helpful: The Swing Tutorial, Java2s tutorial and Java Beginner Tutorial. And certainly you can ask Stackoverflow if you get stuck at some point, or want an opinion
...

Related

Dynamic creation of JTabbedPane

I'm beginner with Netbeans and GUI. I want to create JTabbedPane by click on one button and wants also that tabbed pane name will be the name of the button: I used this code but nothing appears!
JTabbedPane jtp1=new JTabbedPane();
jtp1.setVisible(true);
jtp1.addTab(jButton1.getName(), jPanel6);
I want also to add this tabbed pane to a panel and it will be the same size of the panel.
I highly recommend working through this tutorial from Oracle before you spend a lot of time figuring out how to make it work in netbeans. At some point you will have to understand what netbeans is doing to the code and why... it is a lot easier to get that info first and then use the IDE to help shortcut it then to try and figure out where in the mess of code the IDE generated you should start learning.
http://docs.oracle.com/javase/tutorial/uiswing/

Error adding Panel to JFrame in NetBeans

So I made a JPanel and a JFrame using the Design functions in NetBeans and when I try to drag the panel onto the JFrame, I get the error "The component cannot be instantiated. Please make sure it is a JavaBeans component."
What I did was create an empty Frame and then create the Panel and put it all together using the panels, buttons, and text fields. I didn't modify the source code or anything. Is there some kind of code I need to add into the panel to make it work with the JFrame? Or perhaps I missed a step in the design tab? I've included a picture that shows exactly what it is I made.
jpanel
Clean and build the project (and sub projects as required).
If you're using Netbeans 7+, you can check the messages.log found in C:/Users/{username}/AppData/Roaming/NetBeans/{Netbeans version}/var/log and check for the exception that caused the problem.
I think the new 7.2 beta reports the problems to the user now (thankfully).

I cant figure out how to use java gui / layouts?

how can I make a gui interface with everything in order I know the borderlayout, flowlayout and gridlayout but what is panel? im so confused please help in visual basic I just dragged and dropped. im using netbeans 7.1, I can do layouts and stuff the problem is its so confusing to make all these panels and stuff and (x, y) axis where to place them I want the gui nice and neat
how can I make a gui interface with everything in order
For a single column or row, see GridLayout1 & BoxLayout2, as well as JToolBar3 & JList4.
See 'How To Use':
GridLayout
BoxLayout
JToolBar
JList
Have you seen these examples http://docs.oracle.com/javase/tutorial/uiswing/layout/visual.html ?
I was used to creating java GUI with manual coding, I mean not the drag and dropped that auto-generates the codes, so it was a lot easier for me to switch with GUI designer such as Window Builder plugin for Eclipse or the built-in swing designer of NetBeans.
I suggest you to start with the basic of Layout Managers with manual coding. Here's a good link... http://docs.oracle.com/javase/tutorial/uiswing/layout/visual.html
Start with the easiest: FlowLayout, GridLayout, and BorderLayout. These layouts are usually applied to JPanel, which is a lower level container (JFrame being the top-level container)

List of buttons in swing

I would like to implement a list of interactive buttons using Swing. It is something similar as on the picture (from NetBeans UI designer):
You can drag and drop the items to a canvas, or single click on the item and then single click on the canvas. However, I don't know which swing components I should use. Are that JList or JButtons or something different?
There is a tutorial avalaible on how to achieve such functionality. It is utilizing the NetBeans Palette API, which makes you dependent on NetBeans as Framework, not IDE.
Depending on the goal, you might want to look into developing for the NetBeans Platform.

JTattoo look and feel Java - What's happening exactly?

I downloaded JTattoo.jar for the look and feel of my application. However I am confused, is the look-and-feel concept a run-time issue (I will only see the JTattoo look and feel when I run the application but not on the Designer)?? or can I have the components added in the Palette so I can drag and drop the components??
Can you provide me with info to work with libraries other than Swing and have more desktop items in the Palette??
Thanks
The look and feel will be applied in run time rather than design time because IDE doesn't support that in design time naively.
If you mean you need swing components with external functionality try SwingX
Moreover you can add swingx components (or any other component library) to netbeans designer for example by following these steps:
Go to the Palette Manager (Tools → Palette → Swing/AWT Components), click New Category…, name it SwingX, click Add from Library…, and select the SwingX library that you created in step 3. Activate all the components (Ctrl-A), choose the SwingX category, and you’re done!

Categories

Resources