Solved

How to open a custom dialog box in SWT?

Posted on 2013-06-24
7
496 Views
Last Modified: 2013-08-27
Hi,
I have a GUI in SWT and in this GUI when I click on a button in the toolbar, I would like to see the view that I show in the attachment.

How can I do it in SWT?
changelist-dialog.png
0
Comment
Question by:Tolgar
  • 4
  • 2
7 Comments
 
LVL 7

Expert Comment

by:gudii9
ID: 39273574
0
 
LVL 16

Accepted Solution

by:
Valeri earned 500 total points
ID: 39298291
1. In your ToolBarListener add the following code for the respective "itemAAA"
} else if (toolItem == Gui.itemAAA) {
ChangeListDlg chngListDlg = new ChangeListDlg(shell);
chngListDlg.open();
}

2. in GUI.java add listener for this item
item2.addListener(SWT.Selection, toolBarListener);

3. you have to add to your project the attached file.
CustomInputDialog.java
0
 

Author Comment

by:Tolgar
ID: 39330903
Hi Valeri,
I added the following code to my ToolBarListener:

} else if (toolItem == Gui.item11) {
ChangeListDlg chngListDlg = new ChangeListDlg(shell);
chngListDlg.open();
}

Open in new window


Problem: It complains about "ChangeListDlg". It says "ChangeListDlg" cannot be resolved to a type. And the quick fix it recommends is to create a ChangeListDlg class. Do you think there is something wrong about the names of the classes?


I also added the following line to my Gui.java:

item11.addListener(SWT.Selection, toolBarListener);

Open in new window


and I created "CustomInputDialog.java" class.

Is there anything that I am missing in here?

Thanks,
0
Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

 

Author Comment

by:Tolgar
ID: 39362695
0
 
LVL 16

Expert Comment

by:Valeri
ID: 39364602
ops, I'm really so sorry! :-( attached is the right file...
ChangeListDlg.java
0
 

Author Comment

by:Tolgar
ID: 39364635
Awesome! Thank you so much. It works great

Can you also take a look at these two questions:

http://www.experts-exchange.com/Programming/Languages/Java/Q_28190298.html

http://www.experts-exchange.com/Programming/Languages/Java/Q_28190295.html3

Thanks!
0
 

Author Comment

by:Tolgar
ID: 39443421
Hi Valeri,
Can you please take a look at this open question:

http://www.experts-exchange.com/Programming/Languages/Java/Q_28221229.html

Thanks,
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SHA2 certs for IIS AND Java? 2 122
Java exception bubble up 2 24
Eclipse for Java EE development 2 45
jmeter usage 4 38
In this post we will learn different types of Android Layout and some basics of an Android App.
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
This video teaches viewers about errors in exception handling.

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question