1+ package webapp ;
2+
3+ import com .google .gwt .core .client .EntryPoint ;
4+ import com .google .gwt .dom .client .Style ;
5+ import com .google .gwt .event .dom .client .ClickEvent ;
6+ import com .google .gwt .event .dom .client .ClickHandler ;
7+ import com .google .gwt .user .client .Command ;
8+ import com .google .gwt .user .client .DOM ;
9+ import com .google .gwt .user .client .Window ;
10+ import com .google .gwt .user .client .ui .*;
11+
12+ public class JGEXWebApp implements EntryPoint {
13+ private int count = 0 ;
14+
15+ @ Override
16+ public void onModuleLoad () {
17+ // Main Layout Panel
18+ DockLayoutPanel rootPanel = new DockLayoutPanel (Style .Unit .PX );
19+ rootPanel .setSize ("100%" , "100%" );
20+
21+ // Menu Bar
22+ MenuBar menuBar = new MenuBar ();
23+ MenuBar fileMenu = new MenuBar (true ); // "true" makes it a drop-down menu
24+ fileMenu .addStyleName ("dropdown-menu" ); // Add CSS class for styling
25+ fileMenu .addItem ("Neew" , (Command ) () -> Window .alert ("New File Clicked" ));
26+ fileMenu .addItem ("Open" , (Command ) () -> Window .alert ("Open File Clicked" ));
27+ fileMenu .addItem ("Save" , (Command ) () -> Window .alert ("Save File Clicked" ));
28+ fileMenu .addItem ("Exit" , (Command ) () -> Window .alert ("Exit Clicked" ));
29+
30+ // Add the "File" menu with the sub-menu
31+ menuBar .addItem ("File" , fileMenu );
32+
33+ menuBar .addItem ("Examples" , (Command ) () -> Window .alert ("Examples Clicked" ));
34+ menuBar .addItem ("Construct" , (Command ) () -> Window .alert ("Construct Clicked" ));
35+ menuBar .addItem ("Constraint" , (Command ) () -> Window .alert ("Constraint Clicked" ));
36+ menuBar .addItem ("Action" , (Command ) () -> Window .alert ("Action Clicked" ));
37+ menuBar .addItem ("Prove" , (Command ) () -> Window .alert ("Prove Clicked" ));
38+ menuBar .addItem ("Lemmas" , (Command ) () -> Window .alert ("Lemmas Clicked" ));
39+ menuBar .addItem ("Options" , (Command ) () -> Window .alert ("Options Clicked" ));
40+ menuBar .addItem ("Help" , (Command ) () -> Window .alert ("Help Clicked" ));
41+
42+ // Wrap menu in a container
43+ SimplePanel menuContainer = new SimplePanel ();
44+ menuContainer .setWidget (menuBar );
45+ menuContainer .setStyleName ("menu-bar-border" ); // Optional: Add custom styling
46+
47+ rootPanel .addNorth (menuContainer , 30 );
48+
49+ // Central Content Panel
50+ VerticalPanel contentPanel = new VerticalPanel ();
51+ contentPanel .setHorizontalAlignment (HasHorizontalAlignment .ALIGN_CENTER );
52+ contentPanel .setSpacing (10 );
53+
54+ Label label = new Label ("Count: 0" );
55+ Button button = new Button ("Click me!" );
56+ Button resetButton = new Button ("Reset count" );
57+
58+ resetButton .addClickHandler (new ClickHandler () {
59+ @ Override
60+ public void onClick (ClickEvent event ) {
61+ count = 0 ;
62+ label .setText ("Count: " + count );
63+ }
64+ });
65+
66+ button .addClickHandler (new ClickHandler () {
67+ @ Override
68+ public void onClick (ClickEvent event ) {
69+ count ++;
70+ label .setText ("Count: " + count );
71+ }
72+ });
73+
74+ contentPanel .add (button );
75+ contentPanel .add (label );
76+ contentPanel .add (resetButton );
77+
78+ rootPanel .add (contentPanel );
79+
80+ RootLayoutPanel .get ().clear ();
81+ RootLayoutPanel .get ().add (rootPanel );
82+ }
83+ }
0 commit comments