Restore
This commit is contained in:
10
Labs/Lab10/Lab10_2230026071/Question2/.classpath
Normal file
10
Labs/Lab10/Lab10_2230026071/Question2/.classpath
Normal file
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
|
||||
<attributes>
|
||||
<attribute name="module" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
17
Labs/Lab10/Lab10_2230026071/Question2/.project
Normal file
17
Labs/Lab10/Lab10_2230026071/Question2/.project
Normal file
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>Question2</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>
|
||||
@@ -0,0 +1,2 @@
|
||||
eclipse.preferences.version=1
|
||||
encoding/<project>=UTF-8
|
||||
BIN
Labs/Lab10/Lab10_2230026071/Question2/bin/MyFrame.class
Normal file
BIN
Labs/Lab10/Lab10_2230026071/Question2/bin/MyFrame.class
Normal file
Binary file not shown.
BIN
Labs/Lab10/Lab10_2230026071/Question2/bin/Start$1.class
Normal file
BIN
Labs/Lab10/Lab10_2230026071/Question2/bin/Start$1.class
Normal file
Binary file not shown.
BIN
Labs/Lab10/Lab10_2230026071/Question2/bin/Start.class
Normal file
BIN
Labs/Lab10/Lab10_2230026071/Question2/bin/Start.class
Normal file
Binary file not shown.
32
Labs/Lab10/Lab10_2230026071/Question2/src/MyFrame.java
Normal file
32
Labs/Lab10/Lab10_2230026071/Question2/src/MyFrame.java
Normal file
@@ -0,0 +1,32 @@
|
||||
import java.awt.FlowLayout;
|
||||
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JFrame;
|
||||
|
||||
public class MyFrame extends JFrame{
|
||||
//constructor
|
||||
public MyFrame() {
|
||||
this.setTitle("MyFrame Title");
|
||||
this.setSize(400, 300);
|
||||
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
this.setLocationRelativeTo(null);
|
||||
|
||||
//the two button overlaped without Layout management
|
||||
JButton b1 = new JButton("b1");
|
||||
this.add(b1);
|
||||
JButton b2 = new JButton("b2");
|
||||
this.add(b2);
|
||||
|
||||
/* Only one button appear as Java would detect same button and remove
|
||||
JButton b = new JButton("B1");
|
||||
this.add(b);
|
||||
this.add(b);
|
||||
*/
|
||||
|
||||
FlowLayout f1 = new FlowLayout(FlowLayout.LEFT, 20, 40);
|
||||
this.setLayout(f1);
|
||||
|
||||
this.setVisible(true);
|
||||
}
|
||||
|
||||
}
|
||||
13
Labs/Lab10/Lab10_2230026071/Question2/src/Start.java
Normal file
13
Labs/Lab10/Lab10_2230026071/Question2/src/Start.java
Normal file
@@ -0,0 +1,13 @@
|
||||
|
||||
public class Start {
|
||||
|
||||
public static void main(String[] args) {
|
||||
javax.swing.SwingUtilities.invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
new MyFrame();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user