1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | private void formWindowOpened(java.awt.event.ActionEvent evt) bgroup1.add(radiolicense); bgroup1.add(radiolicense); } private void radiolicensePerformed(java.awt.event.ActionEvent evt) { cmdsubmit.setEnable( true ); } private void radiolicensePerformed(java.awt.event.ActionEvent evt) { cmdsubmit.setEnable( false ); } //===================================== private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { String qual = "" ; if (jRadioButton1.isSelected()){ qual = "Your Under Graduate" ; } else { qual = "Graduate" ; } JOptionPane.showMessageDialog(rootPane, qual); } |
article
Showing posts with label Java-Swing. Show all posts
Showing posts with label Java-Swing. Show all posts
Wednesday, July 3, 2019
Java Swing jRadioButton Usage Tutorial
Tuesday, July 2, 2019
Java Swing JPasswordField & JCheckBox Usage - Login Example Tutorial
Java Swing JPasswordField & JCheckBox Usage - Login Example Tutorial
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | private void cmdloginActionPerformed(java.awt.event.ActionEvent evt) { if (txtusername.getText().equalsIgnoreCase( "test" ) && txtpass.getText().equalsIgnoreCase( "123" )){ if (chkremember.isSelected()){ lblmessage.setText( "Login successful with remembering option" ); } else { lblmessage.setText( "Login successful without remembering option" ); } } else { lblmessage.setText( "Login Failed" ); } } private void cmdloginActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: String userName = txtusername.getText(); String password = txtpass.getText(); if (userName.trim().equals( "admin" ) && password.trim().equals( "admin" )) { lblmessage.setText( "Hello" + userName + "" ); } else { lblmessage.setText( "Invalid User" ); } } private void cmdresetActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: lblmessage.setText( "" ); txtusername.setText( "" ); txtpass.setText( "" ); } |
Monday, July 1, 2019
Java Swing Tutorial JTextField Usage Using Netbeans IDE
Java Swing Tutorial JTextField Usage Using Netbeans IDE
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | private void cmdsubmitActionPerformed(java.awt.event.ActionEvent evt) { String message = "Hello," +txtname.getText(); lblmessagedisplay.setText(message); } private void cmdsubmitActionPerformed(java.awt.event.ActionEvent evt) { int a=Integer.parseInt(x); String y=(String) jComboBox1.getSelectedItem(); int b=Integer.parseInt(y); int r=a*b; String z=Integer.toString(r); txtresult.setText(z); } private void cmdsubmitActionPerformed(java.awt.event.ActionEvent evt) { String s1=tf1.getText(); String s2=tf2.getText(); int a=Integer.parseInt(s1); int b=Integer.parseInt(s2); int c= 0 ; c=a+b; String result=String.valueOf(c); tf3.setText(result); } |
Sunday, June 30, 2019
Java Swing if else statement using Netbeans IDE
Java Swing if else statement using Netbeans IDE
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | public static void main(String args[]) { String input = JOptionPane.showInputDialog( "Enter your age" ); int aga = Integer.parseInt(input); if (age >= 18 ){ JOptionPane.showMessageDialog( null , "You are an adult" ); } else { JOptionPane.showMessageDialog( null , "You are a minor" ); } /* Create and display the form */ java.awt.EventQueue.invokeLater( new Runnable() { public void run() { new JTextField_JFrame().setVisible( true ); } }); } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | public static void main(String args[]) { int side1 = Integer.parseInt(JOptionPane.showInputDialog( "Enter the first side" )); int side2 = Integer.parseInt(JOptionPane.showInputDialog( "Enter the second side" )); int side3 = Integer.parseInt(JOptionPane.showInputDialog( "Enter the third side" )); if (side1 == side2 && side2 == side3){ JOptionPane.showMessageDialog( null , "It is an equilateral triangle" ); } else { if (side1 == side2 || side2 == side3) { JOptionPane.showMessageDialog( null , "It is an isosceles triagle" ) } else { JOptionPane.showMessageDialog( null , "It is an scalene triagle" ) } } /* Create and display the form */ java.awt.EventQueue.invokeLater( new Runnable() { public void run() { new JTextField_JFrame().setVisible( true ); } }); } |
How to create simple Java Swing GUI with Netbeans IDE
How to create simple Java Swing GUI with Netbeans IDE
1 2 3 4 5 6 | private void cmdsubmitbuttonActionPerformed(java.awt.event.ActionEvent evt) { //GEN-FIRST:event_cmdsubmitbuttonActionPerformed // TODO add your handling code here: String name = JOptionPane.showInputDialog( "Type your name please" ); JOptionPane.showMessageDialog( null , "Hello " + name); //JOptionPane.showMessageDialog(null, "Hello World"); } //GEN-LAST:event_cmdsubmitbuttonActionPerformed |
Friday, June 10, 2016
Java Swing
Java Swing
Swing is the principal GUI toolkit for the Java programming language. It is a part of the JFC (Java Foundation Classes), which is an API for providing a graphical user interface for Java programs. It is completely written in Java.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | package com.tutorial101; import java.awt.EventQueue; import javax.swing.JFrame; public class SimpleEx extends JFrame { public SimpleEx() { initUI(); } private void initUI() { setTitle( "Simple example" ); //window title setSize( 300 , 200 ); //size window setLocationRelativeTo( null ); setDefaultCloseOperation(EXIT_ON_CLOSE); } public static void main(String[] args) { EventQueue.invokeLater( new Runnable() { //This method will close the window if we click on the close button of the titlebar @Override public void run() { SimpleEx ex = new SimpleEx(); ex.setVisible( true ); } }); } } |
Subscribe to:
Posts (Atom)