mirror of
https://github.com/macocianradu/javaGUItoolkit.git
synced 2026-03-19 06:00:04 +00:00
added debugger and timer
improved paint efficiency debugged relative position removed bug in parser for empty attribute methods
This commit is contained in:
@@ -1,59 +1,39 @@
|
||||
import guiTree.Components.Button;
|
||||
import guiTree.Components.Panel;
|
||||
import guiTree.Window;
|
||||
import guiTree.events.MouseAdapter;
|
||||
import parser.XAMLParser;
|
||||
|
||||
import java.awt.event.MouseEvent;
|
||||
|
||||
|
||||
public class Main {
|
||||
public static void main(String[] args) {
|
||||
try{
|
||||
Window window = XAMLParser.parse("ui.xml");
|
||||
assert window != null;
|
||||
window.repaint();
|
||||
Button button = (Button)window.findByName("button3");
|
||||
button.addMouseListener(new MouseAdapter() {
|
||||
|
||||
Button button1 = (Button)window.findByName("button1");
|
||||
button1.addMouseListener(new MouseAdapter() {
|
||||
@Override
|
||||
public void mouseClicked(MouseEvent mouseEvent) {
|
||||
Panel panel = window.getMainPanel();
|
||||
if(panel.getOverlapping()) {
|
||||
panel.setOverlapping(false);
|
||||
}
|
||||
else {
|
||||
panel.setOverlapping(true);
|
||||
}
|
||||
window.repaint();
|
||||
System.out.println("Button x: " + button1.getLocationX() + " y: " + button1.getLocationY());
|
||||
}
|
||||
});
|
||||
|
||||
window.repaint();
|
||||
System.out.println(Float.parseFloat("3"));
|
||||
long now;
|
||||
long prev = 0;
|
||||
// while(true) {
|
||||
// now = System.currentTimeMillis();
|
||||
// if(now - prev >= 1000) {
|
||||
// int x = button.getLocationX();
|
||||
// int y = button.getLocationY();
|
||||
// if(x + button.getWidth() >= window.getWidth()) {
|
||||
// x = 0;
|
||||
// if(y + button.getHeight() >= window.getHeight()) {
|
||||
// y = 0;
|
||||
// }
|
||||
// else {
|
||||
// y += 30;
|
||||
// }
|
||||
// }
|
||||
// else {
|
||||
// x += 30;
|
||||
// }
|
||||
// button.setLocation(x, y);
|
||||
// prev = now;
|
||||
// window.revalidate();
|
||||
// }
|
||||
// }
|
||||
Button button2 = (Button)window.findByName("button2");
|
||||
button2.addMouseListener(new MouseAdapter() {
|
||||
@Override
|
||||
public void mouseClicked(MouseEvent mouseEvent) {
|
||||
System.out.println("Button x: " + button2.getLocationX() + " y: " + button2.getLocationY());
|
||||
}
|
||||
});
|
||||
|
||||
Button button4 = (Button)window.findByName("button4");
|
||||
button4.addMouseListener(new MouseAdapter() {
|
||||
@Override
|
||||
public void mouseClicked(MouseEvent mouseEvent) {
|
||||
System.out.println("Button x: " + button4.getLocationX() + " y: " + button4.getLocationY());
|
||||
}
|
||||
});
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user