Skip to content

Commit

Permalink
swing components
Browse files Browse the repository at this point in the history
  • Loading branch information
Shubh2-0 committed Mar 30, 2023
1 parent 76cdb8f commit 18c2f98
Show file tree
Hide file tree
Showing 65 changed files with 855 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/.metadata/
10 changes: 10 additions & 0 deletions ComboBox/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>
17 changes: 17 additions & 0 deletions ComboBox/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>ComboBox</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
2 changes: 2 additions & 0 deletions ComboBox/.settings/org.eclipse.core.resources.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
eclipse.preferences.version=1
encoding/<project>=UTF-8
14 changes: 14 additions & 0 deletions ComboBox/.settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=17
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=17
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
org.eclipse.jdt.core.compiler.release=enabled
org.eclipse.jdt.core.compiler.source=17
Binary file added ComboBox/bin/com/masai/main/ComboBox$1.class
Binary file not shown.
Binary file added ComboBox/bin/com/masai/main/ComboBox.class
Binary file not shown.
70 changes: 70 additions & 0 deletions ComboBox/src/com/masai/main/ComboBox.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
package com.masai.main;

import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JLabel;
import java.awt.Font;
import javax.swing.SwingConstants;
import javax.swing.JComboBox;

public class ComboBox {

private JFrame frame;

/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
ComboBox window = new ComboBox();
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}

/**
* Create the application.
*/
public ComboBox() {
initialize();
}

/**
* Initialize the contents of the frame.
*/
private void initialize() {
frame = new JFrame();
frame.setBounds(100, 100, 747, 522);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().setLayout(null);

JLabel lblNewLabel = new JLabel("Combo Box Example");
lblNewLabel.setHorizontalAlignment(SwingConstants.CENTER);
lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 30));
lblNewLabel.setBounds(137, 27, 486, 81);
frame.getContentPane().add(lblNewLabel);

JComboBox comboBox = new JComboBox();
comboBox.setToolTipText("");
comboBox.setFont(new Font("Tahoma", Font.PLAIN, 20));
comboBox.addItem("Maths");
comboBox.addItem("Commerce");
comboBox.addItem("Arts");
comboBox.addItem("Bio");


comboBox.setBounds(287, 155, 165, 45);
frame.getContentPane().add(comboBox);

JLabel lblNewLabel_1 = new JLabel("Select Subject : ");
lblNewLabel_1.setFont(new Font("Arial Black", Font.PLAIN, 25));
lblNewLabel_1.setBounds(58, 153, 231, 45);
frame.getContentPane().add(lblNewLabel_1);
}
}
10 changes: 10 additions & 0 deletions Image_As_Label/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>
17 changes: 17 additions & 0 deletions Image_As_Label/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Image_As_Label</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
2 changes: 2 additions & 0 deletions Image_As_Label/.settings/org.eclipse.core.resources.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
eclipse.preferences.version=1
encoding/<project>=UTF-8
14 changes: 14 additions & 0 deletions Image_As_Label/.settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=17
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=17
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
org.eclipse.jdt.core.compiler.release=enabled
org.eclipse.jdt.core.compiler.source=17
Binary file added Image_As_Label/bin/com/masai/Main/ImageLabel$1.class
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added Image_As_Label/bin/images/password.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Image_As_Label/bin/images/user.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Image_As_Label/bin/images/user2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
120 changes: 120 additions & 0 deletions Image_As_Label/src/com/masai/Main/ImageLabel.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
package com.masai.Main;

import java.awt.EventQueue;

import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;

import java.awt.Font;
import java.awt.Image;
import javax.swing.SwingConstants;
import java.awt.SystemColor;
import javax.swing.JTextField;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

public class ImageLabel {

private JFrame frame;
private JTextField textField;
private JTextField textField_1;
private JLabel lblNewLabel_1;

/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
ImageLabel window = new ImageLabel();
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}

/**
* Create the application.
*/
public ImageLabel() {
initialize();
}

/**
* Initialize the contents of the frame.
*/
private void initialize() {
frame = new JFrame();
frame.getContentPane().setBackground(SystemColor.inactiveCaption);
frame.setBounds(100, 100, 943, 589);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().setLayout(null);

JLabel lblNewLabel = new JLabel("User Login");
lblNewLabel.setHorizontalAlignment(SwingConstants.CENTER);
lblNewLabel.setFont(new Font("Arial", Font.BOLD, 35));
lblNewLabel.setBounds(351, 42, 358, 141);
frame.getContentPane().add(lblNewLabel);
ImageIcon img1 = new ImageIcon(getClass().getResource("/images/user2.png"));
Image i1 = img1.getImage();
Image new_image1 = i1.getScaledInstance(80, 80, Image.SCALE_SMOOTH);
img1 = new ImageIcon(new_image1);
lblNewLabel.setIcon(img1);


lblNewLabel_1 = new JLabel("Username :");
lblNewLabel_1.setFont(new Font("Arial", Font.BOLD, 25));
lblNewLabel_1.setBounds(47, 193, 223, 53);
frame.getContentPane().add(lblNewLabel_1);
img1 = new ImageIcon(getClass().getResource("/images/user.png"));
i1 = img1.getImage();
new_image1 = i1.getScaledInstance(50, 50, Image.SCALE_SMOOTH);
img1 = new ImageIcon(new_image1);
lblNewLabel_1.setIcon(img1);


JLabel lblNewLabel_2 = new JLabel("Password :");
ImageIcon img = new ImageIcon(getClass().getResource("/images/password.png"));
Image i = img.getImage();
Image new_image = i.getScaledInstance(50, 50, Image.SCALE_SMOOTH);
img = new ImageIcon(new_image);

lblNewLabel_2.setIcon(img);
lblNewLabel_2.setFont(new Font("Arial", Font.BOLD, 25));
lblNewLabel_2.setBounds(47, 310, 223, 51);
frame.getContentPane().add(lblNewLabel_2);

textField = new JTextField();
textField.setFont(new Font("Tahoma", Font.PLAIN, 20));
textField.setBounds(302, 193, 452, 54);
frame.getContentPane().add(textField);
textField.setColumns(10);

textField_1 = new JTextField();
textField_1.setFont(new Font("Tahoma", Font.PLAIN, 20));
textField_1.setBounds(302, 309, 452, 54);
frame.getContentPane().add(textField_1);
textField_1.setColumns(10);

JButton btnNewButton = new JButton("Login");
btnNewButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {

JOptionPane.showMessageDialog(null,"Your User name is : "+ textField.getText()+"\n Password is : "+textField_1.getText());

}
});
btnNewButton.setFont(new Font("Inter Black", Font.BOLD, 35));
btnNewButton.setBounds(386, 444, 210, 60);
frame.getContentPane().add(btnNewButton);



}
}
Binary file added Image_As_Label/src/images/password.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Image_As_Label/src/images/user.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Image_As_Label/src/images/user2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions List_IMPORTANT/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>
17 changes: 17 additions & 0 deletions List_IMPORTANT/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>List_IMPORTANT</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
2 changes: 2 additions & 0 deletions List_IMPORTANT/.settings/org.eclipse.core.resources.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
eclipse.preferences.version=1
encoding/<project>=UTF-8
14 changes: 14 additions & 0 deletions List_IMPORTANT/.settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=17
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=17
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
org.eclipse.jdt.core.compiler.release=enabled
org.eclipse.jdt.core.compiler.source=17
Binary file added List_IMPORTANT/bin/com/masai/list/list$1.class
Binary file not shown.
Binary file added List_IMPORTANT/bin/com/masai/list/list$2.class
Binary file not shown.
Binary file added List_IMPORTANT/bin/com/masai/list/list.class
Binary file not shown.
Loading

0 comments on commit 18c2f98

Please sign in to comment.