Solved

How to open a custom dialog box in SWT?

Posted on 2013-06-24
7
484 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
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

747 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now