Example : How to start/open Java (offline project) using Net Beans IDE 8.2 .
- Open Netbeans IDE 8.2 - File - New Project - Select 'Java' from Categories - Select 'Java
Applications' from Projects - Next - Put name of project in 'Project Name' box say 'Java
Application1' - Select the project saving location such as C/D/E drive etc. - Uncheck 'Create Main
Class' option strictly - Finish - Now Java project window appears with 'Projects,Files & Services'
Tabs - .
Example : How to create a new java package/change the ‘default package’ name of Java Applications using Net Beans IDE 8.2 .
- Right click on 'Source Package' of Project name (Java Applications) list - New - Java Package -
change the name as per need - ok.
Example : How to create new jFrame / jInternal Frame / jPanel / jDialog form file using Net Beans IDE 8.2 .
- Right click on 'Source Package/Default Package' name - New - Other - Swing GUI Forms - choose
needed form file - change the name of chosen form file - finish.
Example : How to recover the disappear Palette / Properties window / Projects tabs / Files tabs / Services tabs in Net Beans IDE 8.2 .
- Click on 'Window' menu in Net Beans IDE 8.2 - choose 'Projects/Files/Services' or 'IDE Tools' -
choose 'Palette/Properties' option.
Example : How to recover the disappear Source Code Editor / Design Window in Net Beans IDE 8.2 .
- Open Netbeans IDE 8.2 - View menu - check 'show Editor Toolbar'.
-------------- OR -------------
- Open Netbeans IDE 8.2 - View menu - click 'Editors' and choose required one.
-------------- OR -------------
- Open Netbeans IDE 8.2 - open the Page - Right click on open Page tab - Editors - Choose one.
Example : How to run /execute java application form in Net Beans IDE 8.2 .
3 ways to run the file -
- Right click on JFrame Form list in 'Source Package' of java project in 'Projects' tab - click 'Run
File'.
- click on 'Run Project' icon (Triangle Symbol) in the toolbar of Net Beans IDE - Select 'JFrame
Form' to execute it.
- Open 'JFrame Form' we want to execute - select 'Source' tab at upper left portion of page - Right
click in the page - Select 'Run File'.
Example : How to close/exit java application form in Net Beans IDE 8.2 .
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt)
{
System.exit(0);
//super.dispose();
}
Example : How to convert String into Integer and its vice-versa in java using Net Beans IDE 8.2 .
import static javax.swing.JOptionPane.*;
public NumConverion() {
initComponents();
int x1 =Integer.parseInt("1015"); //Code for String into Integer Conversion.
showMessageDialog(null,x1);
int x2 =Integer.parseInt("1025");
showMessageDialog(null,x2);
int x3 = x1+x2;
showMessageDialog(null,x3);
String Str= Integer.toString(x3); //Code for Integer into String Conversion.
showMessageDialog(null,"Total Value = "+ x1+ "+" + x2+ " is "+Str,"Calculation Result",
INFORMATION_MESSAGE);
}
private void jTextField1KeyPressed(java.awt.event.KeyEvent evt) {
int x= evt.getKeyCode(); // evt is default event.
if (x == 10) // 10 is KeyCode for enter key.
{
jTextField2.requestFocus();
}
----------- OR -----------
private void jTextField1KeyPressed(java.awt.event.KeyEvent evt) {
if(evt.getKeyCode()== KeyEvent.VK_ENTER)
{
jTextField2.grabFocus();
}
}
NB : Path = Right click on the text field – Events – Key – Keypressed. Now write above Code is in appeared code area. Do same for all the remaining java controls.
private void jTextField2KeyPressed(java.awt.event.KeyEvent evt) {
if (evt.getKeyCode() == KeyEvent.VK_UP)
{
jTextField1.requestFocus();
}
---------------------------
if (evt.getKeyCode() == KeyEvent.VK_DOWN)
{
jTextField3.requestFocus();
}
}
Example : How to maximize jFrame automatically on load event.
public registration()
{
initComponents();
setExtendedState(java.awt.Frame.MAXIMIZED_BOTH); // to maximize the jFrame window.
//this.setExtendedState(this.MAXIMIZED_BOTH); // to maximize the jFrame window.
}
0 Comments