This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
i am a beginner in java . i m currently working on text editor . i m making a text editor . i have added the menubar to it with several menus . among them is font (as in normal text editors). i want my texteditor to open a separate dialog with several options in it (like font options , and bold italics options) when we click the font menuitem. what am i going to use for that ? Jdialog ?? or something else and how am i going to add components on it .. please guide . my text editor coding so far is listed below and its working fine . i have completed the file menu and insert menu and they are working well . now i m working on the format menu. i want to open a separate dialog (window) with options on it , when we click the font menuitem . please guide me .
newMenuItem.addActionListener( new newMenuItemListener() );
openMenuItem.addActionListener( new openMenuItemListener() );
saveMenuItem.addActionListener( new saveMenuItemListener() );
exitMenuItem.addActionListener( new exitMenuItemListener() );
dateTimeMenuItem.addActionListener( new dateTimeMenuItemListener() );
//fontMenuItem.addActionListener( new fontMenuItemListener() );
//bulletsMenuItem.addActionListener( new bulletsMenuItemListener() );
For the text editor, a JDialog will work well for your (font or whatever) options panel. The potential problem you may get into is how are you going to propapate those changes back to the text area.
Of course there's always a way And it depends on how you write your main GUI class. Currently you have everything (text area, menus, panels buttons) in the main class. I suggest you can use more of a OO approach by say separating the menu bar to a new class extends JMenuBar and load your new menu class in the main class.
The code below is a simple frame that has a button. when i click the button i want to open a dialog with options (including checkboxes, and combobox) . can you please tell me how to create and show that dialog . I am still not able to understand how to use Jdialog box . If i get to understand this basic thing here in this simple code , I will be able to do it in my textEditor application.I want the dialog box to generate in the action performed method