Open GUI Java file with Netbeans - java

I created a .java file with NetBeans 6.9 GUI builder. Then I transfered the file to my LInux machine and tried to open it up and continue editing with the GUI builder.
But I notice that I don't have the option for the GUI builder anymore. As in be able to drag and drop buttons and all that.
Any ideas or suggestions?

Swing classes depend on two files: The .java source file and a .form file. You need both to be able to keep working in Netbeans.

Swing classes depend on two files: The .java source file and a .form file. these two files should be same name,same path. then double click the .java file , you can switch it between 'source' and design.

I see two options:
Learn to handcode GUI's. JFrame is super simple! Here is a very nice tutorial.
Re-Install NetBeans. This should reset everything to the default setting. But, it will keep your projects intact.

Related

JD GUI decompiler is not working through any other file open method other than drag and drop on mac

JD GUI decompiler is not working through any other file open method other than drag and drop on mac when I am trying to open a jar file.
I got a similar issue for Java Decompiler JD-GUI.
Below, a solution that I found, working for me.
I found that there is something about security policy which prohibits
jd-gui from accessing certain directory structures, like ~/Documents
for example. It will not see any directory structure beyond it. If I
copy the file structure I want to examine into another accessible dir,
like /tmp/ then I am able to browse.
Source: https://github.com/java-decompiler/jd-gui/issues/335.

Setup icon correctly in IntelliJ so that is gets compiled with program (to jar)

I've been learning Java at my university and the programs we made as homework assignments are quite nice. But I've been playing around with some extra features to learn more. I've created a GUI for a program using Swing and AWT. I've added an icon to the JFrame and when I run the the program in IntelliJ the icon is there. But when I try to compile the program into a JAR file the icon doesn't get compiled with it for some reason.. Is there a way to make this work?
The way I've currently set it up is as follows:
ImageIcon image = new ImageIcon("resources/icon.png");
This is how I've declared the image which is in the resources map of my project, I've marked this resources folder as a resources folder in the project structure under modules.
Then I set the icon as following:
frame.setIconImage(image.getImage());
The name of my JFrame is frame, this all works when running the program within IntelliJ but when I make a jar file it doesn't seem to be able to use the icon ;/
Does someone know how to fix this? I really like to learn from it so some extra explanation would be really nice!!

Runnable jar file generated with java eclipse wont run when double clicked

I made a version of an 2D game by using an applet, java awt and some little java swing. I made a start-class containing a main method in order to export it as a runnable jar file.
The exporting works fine, without any problems.
But when its done and i try to double click the runnable jar file, nothing happens.
When I test it using the run button in eclipse everything works fine...
In the first moment I thought that my start-class may be the issue, but that's not the case. I tested it on an other applet, and there the runnable jar file using the same start-class works fine.
Now my question is: What could be the issue that prevents my runnable jar file from doing stuff when I double click it?
I found the mistake.
I've imported all the pictures i used in this game by using ImageIO.
I typed the names of the Images without a capital letter at the beginning, whilst the pictures in the folder actually had a capital letter.
Java eclipse did not care about it and it worked when i tried it out, but when i tried to open it with the command line, it didnt work aswell as it didnt work with a normal doubleclick.
i hope this helps others who got the same issue ^^
try right clicking on the file, select 'open with', 'Choose default program' and then select java Java(TM) Platform SE binary. If you don't see that option you should search for the javaw.exe in your java installation folder and select it. Also you should check Use the selected program to open this kind of file

How to make PDE file in Netbeans

I have a Java GUI project in netbeans and I want to make Processing Development Environment (PDE) file of it. I have searched everywhere but couldn't find the solution. Please help.
A .pde file is really just a text file with a .pde extension. You can prove this by opening up a .pde file in a basic text editor like notepad or JEdit.
So to create a .pde file, you just have to print some Processing code to a text file and give it a name that ends with .pde.
If you have file associations set up (which happens automatically when you install Processing), then the Processing editor will open .pde files be default.
The Processing editor expects .pde files to be in a folder with the same name as the .pde file, but I think it will actually detect this and move it for you, so that might not be strictly necessary.
Edit: But I wonder if that's what you're actually asking. If what you're actually asking is how to use Processing as a Java library in Netbeans, then that's a different question.
If that is what you're asking, then you're no longer using a .pde file. Instead, you'll need to create a Java project, then add the Processing library jars (located in the Processing directory) to your classpath. After that you can call Processing from Java, and most projects will start with a class that extends PApplet. That class contains your sketch code, and you launch it by calling PApplet.main("YourSketchNameHere"); from the regular main() method.

Java how to render a program with GUI

I made a program that has Buttons and TextFields and is it possible to make and feel like real program. And render the program so that i can run in folders etc.
In Java you can use Swing or JavaFx to make GUI applications. Here is another link for JavaFx.
If you want to export your GUI as an application that you can double click and run from your Desktop, you can export as a runnable jar. To do this in eclipse go to File -> export -> Java -> Runnable Jar and then choose the destination etc... Also see this answer for more information on different ways to make a java file executable.

Categories