Problem with JDialog box

Hi Guys,
I have a problem with the JDialog box. The close button (Cross mark of the box) is not displayed when I was trying to use my custom LookAndFeel and Custom theme. I am pasting the code sample here.
import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.swing.Icon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.LookAndFeel;
import javax.swing.SwingUtilities;
import javax.swing.UIDefaults;
import javax.swing.UIManager;
import javax.swing.plaf.ColorUIResource;
import com.jgoodies.looks.plastic.Plastic3DLookAndFeel;
import com.jgoodies.looks.plastic.PlasticTheme;
import com.medplexus.looks.plastic.theme.SkyGreen;
public class TestTheDialog implements ActionListener {
JFrame mainFrame = null;
JButton myButton = null;
public TestTheDialog() {
mainFrame = new JFrame("TestTheDialog Tester");
mainFrame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {System.exit(0);}
try{
     MyLookAndFeel.setCurrentTheme(new CustomLaF());
     UIManager.setLookAndFeel(new MyLookAndFeel());
     SwingUtilities.updateComponentTreeUI(mainFrame);
     CustomDialog cd = new CustomDialog();
     cd.setDefaultLookAndFeelDecorated(true);
catch(Exception e){
myButton = new JButton("Test the dialog!");
myButton.addActionListener(this);
mainFrame.setLocationRelativeTo(null);
mainFrame.getContentPane().add(myButton);
mainFrame.setSize(200, 150);
//mainFrame.pack();
mainFrame.setVisible(true);
public void actionPerformed(ActionEvent e) {
if(myButton == e.getSource()) {
System.err.println("Opening dialog.");
CustomDialog myDialog = new CustomDialog(mainFrame, true, "Do you like Java?");
System.err.println("After opening dialog.");
if(myDialog.getAnswer()) {
System.err.println("The answer stored in CustomDialog is 'true' (i.e. user clicked yes button.)");
else {
System.err.println("The answer stored in CustomDialog is 'false' (i.e. user clicked no button.)");
static class CustomLaF extends PlasticTheme {
protected ColorUIResource getPrimary1() {
return new ColorUIResource(255,128,0);
public ColorUIResource getPrimary2() {
          return (new ColorUIResource(Color.white));
     public ColorUIResource getPrimary3() {
          return (new ColorUIResource(255,128,0));
public ColorUIResource getPrimaryControl() {
return new ColorUIResource(Color.GREEN);
protected ColorUIResource getSecondary1() {
return new ColorUIResource(Color.CYAN);
protected ColorUIResource getSecondary2() {
          return (new ColorUIResource(Color.gray));
     protected ColorUIResource getSecondary3() {
          return (new ColorUIResource(235,235,235));
     protected ColorUIResource getBlack() {
          return BLACK;
     protected ColorUIResource getWhite() {
          return WHITE;
     private Object getIconResource(String s) {
return LookAndFeel.makeIcon(getClass(), s);
private Icon getHastenedIcon(String s, UIDefaults uidefaults) {
Object obj = getIconResource(s);
return (Icon) ((javax.swing.UIDefaults.LazyValue) obj).createValue(uidefaults);
static class MyLookAndFeel extends Plastic3DLookAndFeel {
          protected void initClassDefaults(UIDefaults table) {
               super.initClassDefaults(table);
          protected void initComponentDefaults(UIDefaults table) {
               super.initComponentDefaults(table);
               Object[] defaults = {
                         "MenuItem.foreground",new ColorUIResource(Color.white),
                         "MenuItem.background",new ColorUIResource(Color.gray),
                         "MenuItem.selectionForeground",new ColorUIResource(Color.gray),
                         "MenuItem.selectionBackground",new ColorUIResource(Color.white),
                         "Menu.selectionForeground", new ColorUIResource(Color.white),
                         "Menu.selectionBackground", new ColorUIResource(Color.gray),
                         "MenuBar.background", new ColorUIResource(235,235,235),
                         "Menu.background", new ColorUIResource(235,235,235),
                         "Desktop.background",new ColorUIResource(235,235,235),
                         "Button.select",new ColorUIResource(255,128,0),
                         "Button.focus",new ColorUIResource(255,128,0),
                         "TableHeader.background", new ColorUIResource(255,128,0),
                         "TableHeader.foreground", new ColorUIResource(Color.white),
                         "ScrollBar.background", new ColorUIResource(235,235,235),
                         "OptionPane.questionDialog.border.background", new ColorUIResource(Color.gray),
                         "OptionPane.errorDialog.titlePane.foreground", new ColorUIResource(Color.white),
                         "OptionPane.questionDialog.titlePane.background", new ColorUIResource(255,128,0),
                         "InternalFrame.borderColor", new ColorUIResource(Color.gray),
                         "InternalFrame.activeTitleForeground", new ColorUIResource(Color.white),
                         "InternalFrame.activeTitleBackground", new ColorUIResource(Color.gray),
                         "InternalFrame.borderColor", new ColorUIResource(Color.white),
                         "Table.selectionBackground",new ColorUIResource(255,128,0)
               table.putDefaults(defaults);
public static void main(String argv[]) {
TestTheDialog tester = new TestTheDialog();
package CustomThemes;
import javax.swing.JDialog;
import java.awt.event.ActionListener;
import javax.swing.JPanel;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JButton;
import java.awt.event.ActionEvent;
public class CustomDialog extends JDialog implements ActionListener {
private JPanel myPanel = null;
private JButton yesButton = null;
private JButton noButton = null;
private boolean answer = false;
public boolean getAnswer() { return answer; }
public CustomDialog(){
public CustomDialog(JFrame frame, boolean modal, String myMessage) {
super(frame, modal);
setTitle("Guess?");
myPanel = new JPanel();
getContentPane().add(myPanel);
myPanel.add(new JLabel(myMessage));
yesButton = new JButton("Yes");
yesButton.addActionListener(this);
myPanel.add(yesButton);
noButton = new JButton("No");
noButton.addActionListener(this);
myPanel.add(noButton);
setDefaultCloseOperation(EXIT_ON_CLOSE);
pack();
setLocationRelativeTo(frame);
setVisible(true);
public void actionPerformed(ActionEvent e) {
if(yesButton == e.getSource()) {
System.err.println("User chose yes.");
answer = true;
setVisible(false);
else if(noButton == e.getSource()) {
System.err.println("User chose no.");
answer = false;
setVisible(false);
Thanks and Regards
Kumar.

Hi All,
I am using the JGoodies Look and feel (looks2.0.1.jar). I wrote my own custom LookAndFeel and Theme , but the problem with this is the JDialog/JOptionPane dialog boxes are displayed with out the close button (cross button on the titlebar).
I am pasting the code here.
import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.swing.Icon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.LookAndFeel;
import javax.swing.SwingUtilities;
import javax.swing.UIDefaults;
import javax.swing.UIManager;
import javax.swing.plaf.ColorUIResource;
import com.jgoodies.looks.plastic.Plastic3DLookAndFeel;
import com.jgoodies.looks.plastic.PlasticTheme;
import com.medplexus.looks.plastic.theme.SkyGreen;
public class TestTheDialog implements ActionListener {
    JFrame mainFrame = null;
    JButton myButton = null;
    public TestTheDialog() {
        mainFrame = new JFrame("TestTheDialog Tester");
        mainFrame.addWindowListener(new WindowAdapter() {
                public void windowClosing(WindowEvent e) {System.exit(0);}
        try{
             MyLookAndFeel.setCurrentTheme(new CustomLaF());
             UIManager.setLookAndFeel(new MyLookAndFeel());
             //Plastic3DLookAndFeel.setCurrentTheme(new SkyGreen());
             //UIManager.setLookAndFeel(new Plastic3DLookAndFeel());
             SwingUtilities.updateComponentTreeUI(mainFrame);
             CustomDialog cd = new CustomDialog();
             cd.setDefaultLookAndFeelDecorated(true);
        catch(Exception e){
        myButton = new JButton("Test the dialog!");
        myButton.addActionListener(this);
        mainFrame.setLocationRelativeTo(null);
        mainFrame.getContentPane().add(myButton);
        mainFrame.setSize(200, 150);
        //mainFrame.pack();
        mainFrame.setVisible(true);
    public void actionPerformed(ActionEvent e) {
        if(myButton == e.getSource()) {
            System.err.println("Opening dialog.");
            CustomDialog myDialog = new CustomDialog(mainFrame, true, "Do you like Java?");
            System.err.println("After opening dialog.");
            if(myDialog.getAnswer()) {
                System.err.println("The answer stored in CustomDialog is 'true' (i.e. user clicked yes button.)");
            else {
                System.err.println("The answer stored in CustomDialog is 'false' (i.e. user clicked no button.)");
    static class CustomLaF extends PlasticTheme {
        protected ColorUIResource getPrimary1() {
          return new ColorUIResource(255,128,0);
        public ColorUIResource getPrimary2() {
              return (new ColorUIResource(Color.white));
         public ColorUIResource getPrimary3() {
              return (new ColorUIResource(255,128,0));
        public ColorUIResource getPrimaryControl() {
          return new ColorUIResource(Color.GREEN);
        protected ColorUIResource getSecondary1() {
          return new ColorUIResource(Color.CYAN);
        protected ColorUIResource getSecondary2() {
              return (new ColorUIResource(Color.gray));
         protected ColorUIResource getSecondary3() {
              return (new ColorUIResource(235,235,235));
         protected ColorUIResource getBlack() {
              return BLACK;
         protected ColorUIResource getWhite() {
              return WHITE;
         private Object getIconResource(String s) {
            return LookAndFeel.makeIcon(getClass(), s);
        private Icon getHastenedIcon(String s, UIDefaults uidefaults) {
            Object obj = getIconResource(s);
            return (Icon) ((javax.swing.UIDefaults.LazyValue) obj).createValue(uidefaults);
      static class MyLookAndFeel extends Plastic3DLookAndFeel {
              protected void initClassDefaults(UIDefaults table) {
                   super.initClassDefaults(table);
              protected void initComponentDefaults(UIDefaults table) {
                   super.initComponentDefaults(table);
                   Object[] defaults = {
                             "MenuItem.foreground",new ColorUIResource(Color.white),
                             "MenuItem.background",new ColorUIResource(Color.gray),
                             "MenuItem.selectionForeground",new ColorUIResource(Color.gray),
                             "MenuItem.selectionBackground",new ColorUIResource(Color.white),
                             "Menu.selectionForeground", new ColorUIResource(Color.white),
                             "Menu.selectionBackground", new ColorUIResource(Color.gray),
                             "MenuBar.background", new ColorUIResource(235,235,235),
                             "Menu.background", new ColorUIResource(235,235,235),
                             "Desktop.background",new ColorUIResource(235,235,235),
                             "Button.select",new ColorUIResource(255,128,0),
                             "Button.focus",new ColorUIResource(255,128,0),
                             "TableHeader.background", new ColorUIResource(255,128,0),
                             "TableHeader.foreground", new ColorUIResource(Color.white),
                             "ScrollBar.background",  new ColorUIResource(235,235,235),
                             "OptionPane.questionDialog.border.background", new ColorUIResource(Color.gray),
                             "OptionPane.errorDialog.titlePane.foreground", new ColorUIResource(Color.white),
                             "OptionPane.questionDialog.titlePane.background", new ColorUIResource(255,128,0),
                             "InternalFrame.borderColor", new ColorUIResource(Color.gray),
                             "InternalFrame.activeTitleForeground", new ColorUIResource(Color.white),
                             "InternalFrame.activeTitleBackground", new ColorUIResource(Color.gray),
                             "InternalFrame.borderColor", new ColorUIResource(Color.white),
                             "Table.selectionBackground",new ColorUIResource(255,128,0)
                   table.putDefaults(defaults);
    public static void main(String argv[]) {
        TestTheDialog tester = new TestTheDialog();
import javax.swing.JDialog;
import java.awt.event.ActionListener;
import javax.swing.JPanel;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JButton;
import java.awt.event.ActionEvent;
public class CustomDialog extends JDialog implements ActionListener {
    private JPanel myPanel = null;
    private JButton yesButton = null;
    private JButton noButton = null;
    private boolean answer = false;
    public boolean getAnswer() { return answer; }
    public CustomDialog(){
    public CustomDialog(JFrame frame, boolean modal, String myMessage) {
        super(frame, modal);
        setTitle("Guess?");
        myPanel = new JPanel();
        getContentPane().add(myPanel);
        myPanel.add(new JLabel(myMessage));
        yesButton = new JButton("Yes");
        yesButton.addActionListener(this);
        myPanel.add(yesButton);       
        noButton = new JButton("No");
        noButton.addActionListener(this);
        myPanel.add(noButton);
        setDefaultCloseOperation(EXIT_ON_CLOSE);
        pack();
        setLocationRelativeTo(frame);
        setVisible(true);
    public void actionPerformed(ActionEvent e) {
        if(yesButton == e.getSource()) {
            System.err.println("User chose yes.");
            answer = true;
            setVisible(false);
        else if(noButton == e.getSource()) {
            System.err.println("User chose no.");
            answer = false;
            setVisible(false);
}Thanks and Regards
Kumar.

Similar Messages

  • Problem with JDialogs

    Hi All,
    I have a problem with JDialogs in my standalone application. This app pops-up multiple JDialogs, say a stack of JDialogs.
    I have a standalone application which runs as a JFrame, call it JFrame1, which is working fine. JFrame1 pops-up a JDialog, on some button click on JFrame1, call it JDialog1, which is also working fine. Now JDialog1 pops-up another JDialog, again on some button click on JDialog1, call it JDialog2, which is too working fine. But, after I finish with JDialog2 and dispose it my JDialog1 is not working fine, though that is the front dialog at present.
    Any ideas why JDialog1 is not working fine? Am I missing anything?
    Thanks,
    Srinivas.

    Hi,
    I have a component called DateComponent that works similar to a JComboBox. When you click a small button of DateComponent, it pops-up a Calendar similar to the drop down list of JComboBox and user can pick a date from it. It gets closed when it loses focus.
    I have this DateComponent on JFrame1, JDialog1 and JDialog2. The Calendar is not being diaplayed on JDialog1 upon clicking the small button of DateComponent after JDialog2 is disposed. But it is being diaplayed properly on JDialog1 before JDialog1 opens JDialog2. What could be wrong?
    I am using JDK1.3.1.
    Thanks,
    Srinivas.

  • I'm having problem with text boxes.  Whenever i hit the enter button to start a new line or paragraph, the cursor doesn't drop down to the next line.  Instead i get this little red + sign in the box.

    I'm having problem with text boxes.  Whenever i hit the enter button to start a new line or paragraph, the cursor doesn't drop down to the next line.  Instead i get this little red + sign in the box.

    You are absolutely right.  Thought Enter meant Enter.  I was wrong.  Thank you for the help.
    Rod Rogers, Broker
    Accredited Land Consultant (ALC)
    Metcalf Land Company, Inc.
    Office: 864-585-0444
    Mobile: 864-316-0297
    Fax: 864-583-6000
    <http://www.metcalfland.com> www.metcalfland.com

  • Problem with jDialog in a JFrame

    Hello to everyone...i'm newby java GUI developer, and i've got a problem with a JDialog within a JFrame...
    I made a JFrame which creates a new customized JDialog in his contructor, like this:
    MioJdialog dlg = new MioJdialog(this, true);
    dlg.setVisible(true);
    ...The "MioJdialog" class store his JFrame parent under a private attribute, in this way:
    class MioJdialog {...
    private Frame parent;
    public MioJdialog (Frame parent, boolean modal){
        this.parent=parent;
    ....}and here's the problem: when i try to close the parent JFrame with a command like this:
    parent.dispose();
    ( in order to close the whole window), sometimes happens that the JFrame is still visible on the screen...and i don't know why...
    got some hints?
    thanks to everyone!
    Edited by: akyra on Jan 14, 2008 4:36 AM
    Edited by: akyra on Jan 14, 2008 4:37 AM
    Edited by: akyra on Jan 14, 2008 4:37 AM

    If you need further help then you need to create a "Short, Self Contained, Compilable and Executable, Example Program (SSCCE)", that demonstrates the incorrect behaviour.
    http://homepage1.nifty.com/algafield/sscce.html
    Don't forget to use the "Code Formatting Tags", so the posted code retains its original formatting.
    http://forum.java.sun.com/help.jspa?sec=formatting

  • Problem with JDialogs and Threads

    Hi. I'm new to this forum and I hope I'm not asking a repeat question. I didn't find what I needed after a quick search of existing topics.
    I have this problem with creating a new JDialog from within a thread. I have a class which extends JDialog and within it I'm running a thread which calls up another JDialog. My problem is that the JDialog created by the Thread does not seem to function. Everything is unclickable except for the buttons in the titlebar. Is there something that I'm missing out on?

    yeah, bad idea, don't do that.

  • Problems with text box borders, tabbing and saving doc in Acrobat Pro 7.1.0

    When I view my form document in Acrobat Reader, there is a red border around several text boxes
    in which I've selected 'NO border'
    Also, I've selected 'column order' for tabbing, but tabs continue to function in order in which I inserted form item (text box, check box or radial button). Since I didn't insert these consecutively, tabs no jump all around the form instead of proceeding in order from top to bottm and left to right.
    I've checked for Mac Acrobat Pro updates and see that there are three  - 7.1.1, 7.1.3, and 7.1.4, and am downloading them for install.
    Do any of the updates fix these problems? Or how can it be fixed?
    On opening document in Reader, I also get a message informing that document cannot be saved with changes and must be printed, even though I've created it with fillable forms.
    Is there some setting for allowing document to be saved?
    I want to be able to have recipient be able to download form, fill it out, save changes, attach to email and return it to me.

    This has been a problem since version 8 on the mac. Acrobat 7 on the mac worked fine with the right side trim but not on the PC.
    We are still having this problem with Acrobat 9.4.0 on the Mac & PC.
    This has now been an issue for 2 versions of Acrobat Pro.(8 & 9)
    Being in Pre Press and having to constantly set the trim for jobs, this is now taking up too much time and costing money.
    Please fix this Adobe.
    and on another note. how hard would it be to display the trim (if set) next to where the page size is?
    If the trim is set it should display it! why should we have to go to document/crop pages>trim.
    Im in a busy Pre Press Dept and the amount of times you have to check a trim size is stupid.
    I always set prefs to display crop / trim / and bleed boxes and this helps but it should display it if its set.
    Thanks
    Hope this is resolved soon.

  • Problem with one box

    One box in my house is not getting all channels and other channels are digitized. All other boxes are fine. Rebooting does not help. Ideas?

    Could be a problem with the connection. Make sure everything is tight both at box and at splitter.
    If that doesn't help, swap the boxes around. If problem follws, you have a bad box, if not, still a problem with that coax run. Could also try swapping ports on the splitter.
    If a forum member gives an answer you like, give them the Kudos they deserve. If a member gives you the answer to your question, mark the answer as Accepted Solution so others can see the solution to the problem.

  • Vendor Master Upload Problem with Check Box

    Hi All,
    I have a problem with Vendor Master Upload program. In one of the screen of XK01 transaction depending upon the PO Box, Postal Code, Other City and Other Region i have to check the PO Box w/o no check Box. So in my program after i check the PO Box, Postal Code, Other City and Other Region values how to write a code that i can check the PO Box w/o no. Or other wise how can i send value to the Po Box w/o no check box. field
    Thanks in advance.

    The call to the first screen should look something like:
        perform dynpro
          tables bdcdata
          using:
         'X' 'SAPMF02K'     '0105',         "Create Vendor: Initial Screen
          ' ' 'RF02K-BUKRS'             'COCO',
          ' ' 'RF02K-KTOKK'             'YYYY',
          ' ' 'USE_ZAV'                 'X'.
    I'm using screen 105, not 100 here.
    Rob

  • Problems with internet box, not wireless router

    I recently got another internet box hoping my problem with disconnections would be solved but sadly it hasn't... This is the second internet box I have gotten from Verizon and it wasn't any better.  The first one kept disconnecting me from the internet and I called tech support and they couldn't help me so they just ended up sending me a new box.  I thought it might be the wireless router but that didn't solve the problem either.  Is there any way to get a newer better box because it seems like the generic box that Verizon sends doesn't last very long and recently I've been disconnecting from the internet anywhere from 2-3 times a day.  Being a college student with all my homework online and a sister and brother also in college makes it really difficult when I can't rely on staying connected. If anyone can help with this I would be very happy.

    #1 Is this on Verizon DSL OR on Verizon FIOS?
    #2 What is the brand and model of this Internet box?
    If you are the original poster (OP) and your issue is solved, please remember to click the "Solution?" button so that others can more easily find it. If anyone has been helpful to you, please show your appreciation by clicking the "Kudos" button.

  • Problem with check box in ALV Grid Display

    I am Displaying Material Master Data in ALV Grid Display with Check Box for each record and if i checked check box then i am processing Update operation in Database,  my question is after perform update operation check box should be clear.
    Kindly help me!!!!

    Hello Raj
    Given the fact that you do not tell us the most important piece of information (namely whether you are using OO-based ALV or not) I assume you are using fm-based ALV lists.
    In this case you probably have defined a USER_COMMAND routine as described in the documentation of the fm.
    FORM user_command  USING r_ucomm LIKE sy-ucomm
                             rs_selfield TYPE slis_selfield.
    * define local data
      DATA: ls_outtab  LIKE LINE OF gt_outtab,
                ld_idx       TYPE i.
      LOOP AT gt_outtab INTO ls_outtab
                     WHERE ( chkbox = 'X' ).
        ld_idx = syst-tabix.
        " Call your update function / method / perform
       ls_outtab-chkbox = space.
       MODIFY gt_outtab FROM ls_outtab INDEX ld_Idx
          TRANSPORTING chkbox.
      ENDLOOP.
    " And now trigger refresh of the ALV display:
      rs_selfield-refresh = 'X'.  " <<< !!!
    ENDFORM.
    Regards
      Uwe

  • Problem with Combo Box in a Dialog Box

    I have a dialog box that includes a combo box.
    For some reason the combo box shows up under the first text box. In other words, the combo box is not separate from the first field. It has the following:
    ComboBox with Sequence showing, then Enter Identifyer
    Textbox URL
    Textbox Enter Resource 1
    Textbox Enter Resource 2
    Textbox Enter Resource 3
    Textbox Enter Resource 4
    Textbox Enter Resource 5
    It's putting the combo box in the first text field...it should be
    ComboBox with Sequence showing
    URL Textbox
    Enter Identifyer Textbox
    Enter Resource 1 Textbox
    Enter Resource 2 Textbox...
    Here is my code:
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    import java.util.*;
    import javax.swing.*;
    import javax.swing.border.*;
    import javax.swing.event.*;
    import dl.*;
    * Dialog to enter container information
    public class AddContainer extends JDialog {
    private JTextField valueBox1;
    private JTextField valueBox2;
    private JTextField valueBox3;
    private JTextField valueBox4;
    private JTextField valueBox5;
    public String value1;
    public String value2;
    public String value3;
    public String value4;
    public String value5;
    private JTextField identifyerBox;
    private JTextField URLBox;
    private JTextField attrBox;
    public String identifyer;
    public String URL;
    public int choice;
    * Constructor.
    public AddContainer(Frame parent) {
    super(parent, "Add Container", true);
    JPanel pp = new JPanel(new DialogLayout2());
    pp.setBorder(new CompoundBorder(
    new EtchedBorder(EtchedBorder.RAISED),
    new EmptyBorder(5,5,5,5)));
    String[] ContStrings = {  "Sequence", "Bag", "Alternative" };
    // Add action listener.
    ActionListener contlst = new ActionListener() {
    public void actionPerformed(ActionEvent e) {
    JComboBox cb = (JComboBox)e.getSource();
    int choice = (int)cb.getSelectedIndex();
    //Create the combo box, select the item at index 0.
    //Indices start at 0, so 2 specifies the Alternative
    JComboBox ContList = new JComboBox(ContStrings);
    ContList.setSelectedIndex(0);
    ContList.addActionListener(contlst);
    //Add combo box to panel.
    pp.add(ContList);
    pp.add(new JLabel("Enter Identifyer"));
    identifyerBox = new JTextField(16);
    pp.add(identifyerBox);
    pp.add(new JLabel("URL"));
    URLBox = new JTextField(16);
    pp.add(URLBox);
    pp.add(new JLabel("Enter Resource 1"));
    valueBox1 = new JTextField(25);
    pp.add(valueBox1);
    pp.add(new JLabel("Enter Resource 2"));
    valueBox2 = new JTextField(25);
    pp.add(valueBox2);
    pp.add(new JLabel("Enter Resource 3"));
    valueBox3 = new JTextField(25);
    pp.add(valueBox3);
    pp.add(new JLabel("Enter Resource 4"));
    valueBox4 = new JTextField(25);
    pp.add(valueBox4);
    pp.add(new JLabel("Enter Resource 5"));
    valueBox5 = new JTextField(25);
    pp.add(valueBox5);
    JPanel p = new JPanel(new DialogLayout2());
    p.setBorder(new EmptyBorder(10, 10, 10, 10));
    p.add(pp);
    ActionListener lst = new ActionListener() {
    public void actionPerformed(ActionEvent evt) {
    identifyer = identifyerBox.getText();
    URL = URLBox.getText();
    value1 = valueBox1.getText();
    value2 = valueBox2.getText();
    value3 = valueBox3.getText();
    value4 = valueBox4.getText();
    value5 = valueBox5.getText();
    dispose();
    JButton saveButton = new JButton("ADD");
    saveButton.addActionListener(lst);
    getRootPane().setDefaultButton(saveButton);
    getRootPane().registerKeyboardAction(lst,
    KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0),
    JComponent.WHEN_IN_FOCUSED_WINDOW);
    p.add(saveButton);
    JButton cancelButton = new JButton("Cancel");
    lst = new ActionListener() {
    public void actionPerformed(ActionEvent evt) {
    dispose();
    cancelButton.addActionListener(lst);
    getRootPane().registerKeyboardAction(lst,
    KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0),
    JComponent.WHEN_IN_FOCUSED_WINDOW);
    p.add(cancelButton);
    getContentPane().add(p, BorderLayout.CENTER);
    pack();
    setResizable(false);
    setLocationRelativeTo(parent);

    Seems the problem is in your DialogLayout2 class which must be in package dl. I tried a grid layout and got something that looks like what you described. I laid out pp with a gridbag layout.
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    import java.util.*;
    import javax.swing.*;
    import javax.swing.border.*;
    import javax.swing.event.*;
    //import dl.*;
    * Dialog to enter container information
    public class jello extends JDialog {
      private JTextField valueBox1;
      private JTextField valueBox2;
      private JTextField valueBox3;
      private JTextField valueBox4;
      private JTextField valueBox5;
      public String value1;
      public String value2;
      public String value3;
      public String value4;
      public String value5;
      private JTextField identifyerBox;
      private JTextField URLBox;
      private JTextField attrBox;
      public String identifyer;
      public String URL;
      public int choice;
      * Constructor.
      public jello(JFrame parent) {
        super(parent, "Add Container", true);
        GridBagLayout gridbag = new GridBagLayout();
        GridBagConstraints gbc = new GridBagConstraints();
        JPanel pp = new JPanel(gridbag);
                            //(new GridLayout(0,2));
                            //(new DialogLayout2());
        pp.setBackground(Color.red);
        pp.setBorder(
          new CompoundBorder(
            new EtchedBorder(EtchedBorder.RAISED),
            new EmptyBorder(5,5,5,5)));
        String[] ContStrings = { "Sequence", "Bag", "Alternative" };
        // Add action listener.
        ActionListener contlst = new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            JComboBox cb = (JComboBox)e.getSource();
            int choice = (int)cb.getSelectedIndex();
        //Create the combo box, select the item at index 0.
        //Indices start at 0, so 2 specifies the Alternative
        JComboBox ContList = new JComboBox(ContStrings);
        ContList.setSelectedIndex(0);
        ContList.addActionListener(contlst);
        //Add combo box to panel.
        gbc.insets = new Insets(2,2,2,2);
        gbc.anchor = gbc.WEST;
        gbc.gridwidth = gbc.REMAINDER;
        pp.add(ContList, gbc);
        gbc.anchor = gbc.EAST;
        gbc.gridwidth = gbc.RELATIVE;
        pp.add(new JLabel("Enter Identifyer"), gbc);
        identifyerBox = new JTextField(16);
        gbc.anchor = gbc.WEST;
        gbc.gridwidth = gbc.REMAINDER;
        pp.add(identifyerBox, gbc);
        gbc.anchor = gbc.EAST;
        gbc.gridwidth = gbc.RELATIVE;
        pp.add(new JLabel("URL"), gbc);
        URLBox = new JTextField(16);
        gbc.anchor = gbc.WEST;
        gbc.gridwidth = gbc.REMAINDER;
        pp.add(URLBox, gbc);
        gbc.anchor = gbc.CENTER;
        gbc.gridwidth = gbc.RELATIVE;
        pp.add(new JLabel("Enter Resource 1"), gbc);
        valueBox1 = new JTextField(25);
        gbc.gridwidth = gbc.REMAINDER;
        pp.add(valueBox1, gbc);
        gbc.gridwidth = gbc.RELATIVE;
        pp.add(new JLabel("Enter Resource 2"), gbc);
        valueBox2 = new JTextField(25);
        gbc.gridwidth = gbc.REMAINDER;
        pp.add(valueBox2, gbc);
        gbc.gridwidth = gbc.RELATIVE;
        pp.add(new JLabel("Enter Resource 3"), gbc);
        valueBox3 = new JTextField(25);
        gbc.gridwidth = gbc.REMAINDER;
        pp.add(valueBox3, gbc);
        gbc.gridwidth = gbc.RELATIVE;
        pp.add(new JLabel("Enter Resource 4"), gbc);
        valueBox4 = new JTextField(25);
        gbc.gridwidth = gbc.REMAINDER;
        pp.add(valueBox4, gbc);
        gbc.gridwidth = gbc.RELATIVE;
        pp.add(new JLabel("Enter Resource 5"), gbc);
        valueBox5 = new JTextField(25);
        gbc.gridwidth = gbc.REMAINDER;
        pp.add(valueBox5, gbc);
        JPanel p = new JPanel();//(new DialogLayout2());
        p.setBackground(Color.blue);
        p.setBorder(new EmptyBorder(10, 10, 10, 10));
        p.add(pp);
        ActionListener lst = new ActionListener() {
          public void actionPerformed(ActionEvent evt) {
            identifyer = identifyerBox.getText();
            URL = URLBox.getText();
            value1 = valueBox1.getText();
            value2 = valueBox2.getText();
            value3 = valueBox3.getText();
            value4 = valueBox4.getText();
            value5 = valueBox5.getText();
            dispose();
        JButton saveButton = new JButton("ADD");
        saveButton.addActionListener(lst);
        getRootPane().setDefaultButton(saveButton);
        getRootPane().registerKeyboardAction(lst,
          KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0),
          JComponent.WHEN_IN_FOCUSED_WINDOW);
        p.add(saveButton);
        JButton cancelButton = new JButton("Cancel");
        lst = new ActionListener() {
          public void actionPerformed(ActionEvent evt) {
            dispose();
        cancelButton.addActionListener(lst);
        getRootPane().registerKeyboardAction(lst,
          KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0),
          JComponent.WHEN_IN_FOCUSED_WINDOW);
        p.add(cancelButton);
        parent.getContentPane().add(p, BorderLayout.CENTER);
        parent.pack();
        parent.setResizable(false);
    //    setLocationRelativeTo(parent);
        parent.setVisible(true);
      public static void main(String[] args) {
        JFrame frame = new JFrame();
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        new jello(frame);
        frame.setLocation(0,200);
    }

  • Problem with combo box in a Matrix column

    hi every one, i  have a user form with a matrix(uid = 37) with some columns and one column is combo box. in that combo box i have to get values  from OSTC table (Code)...i have written this code ..i dont know how to access the combo box so that i can get values to combo box when i execute the prg....
    oitem = oForm.Items.Item("37")  37 is uid of omatrix2
                oMatrix2 = oitem.Specific
                oColumns = oMatrix2.Columns
                oForm.DataSources.UserDataSources.Add("CSR1", SAPbouiCOM.BoDataType.dt_SHORT_TEXT, 1)
                oColumn = oColumns.Item("V_6")                      ''for accessing the combo box item [V_6 is col uid ]
                oCombo = oColumn.Cells.Item(omatrix2.row).Specific            ''''''''problem line
                oCombo.DataBind.SetBound(True, "", "CSR1")
                rset = oDICompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
                query = "select Code from OSTC"
                rset.DoQuery(query)
                Dim tc As String
                rset.MoveFirst()
                For row = 0 To rset.RecordCount - 1
                    tc = rset.Fields.Item("Code").Value
                    oCombo.ValidValues.Add(tc, row)
                    rset.MoveNext()
                Next
                oMatrix2.Columns.Item("V_6").DataBind.SetBound(True, "@SALE_CHILD", "U_Tax")

    Call objMain.objUtilities.LoadComboValuesForMatrix(FormUID, "27", "SELECT Code,Name FROM OSTC Order by Code", "V_19", objMatrix.RowCount)
    Public Sub LoadComboValuesForMatrix(ByVal FormUID As String, ByVal ItemUID As String, ByVal strQuery As String, ByVal MtrxColId As String, ByVal Rowcount As Integer)
            Dim inti As Integer
            objRecSet = objMain.objUtilities.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
            Try
                Dim objmatrix As SAPbouiCOM.Matrix
                Dim objCombo As SAPbouiCOM.ComboBox
                objForm = objMain.objApplication.Forms.Item(FormUID)
                objItem = objForm.Items.Item(ItemUID)
                objmatrix = objItem.Specific
                objCombo = objmatrix.Columns.Item(MtrxColId).Cells.Item(Rowcount).Specific
                objItem.DisplayDesc = True
                objRecSet.DoQuery(strQuery)
                If objRecSet.RecordCount > 0 Then
                    If (objCombo.ValidValues.Count > 0) Then
                        For inti = 0 To objRecSet.RecordCount - 1
                            objRecSet.MoveNext()
                        Next
                    End If
                    If (objCombo.ValidValues.Count <= 0) Then
                        objCombo.ValidValues.Add("", "")
                        For inti = 0 To objRecSet.RecordCount - 1
                            objCombo.ValidValues.Add(Convert.ToString(objRecSet.Fields.Item(0).Value), Convert.ToString(objRecSet.Fields.Item(1).Value))
                            objRecSet.MoveNext()
                        Next
                    End If
                End If
            Catch ex As Exception
                Throw ex
            Finally
                System.Runtime.InteropServices.Marshal.ReleaseComObject(objRecSet)
                GC.WaitForPendingFinalizers()
                GC.Collect()
            End Try
        End Sub

  • Problem with check box need an idea

    hello i need some help.
    i am tring to make a attendence register as an assignment. what i am tring to do is that i can add student name in a file and then retrive them from a file and then mark there presents or absents.the part i cant get done is how do i mark the attendence. i want to display name and then the teacher can just click in the check box infront of the name to mark the present and when he clicks on the save button it would save the attendence in the file.
    now the problem is the check box have to increase and decrease if a name is add or deleted in the file
    SO does any one have any ideas what i can do to solve this problem

    lets suppose your file contains student name which are seperted by comma or space (what ever).then u can read it and open stringtokenizer with delimater you used to seperate names.count the number of tokens and create your check box on the count of tokens.There may be some good idea too and if any one have i would like to know.

  • Problem with combo boxes and the reset button in certain situations

    Hi Everyone,
    i have a problem to make the reset-button function properly in an what-if analysis dashboard.
    The dashboard uses two combo boxes that are not visible at the same time. In my application the second combo box only appears when a dedicated menu (label based menu button) has been activated.
    So i have combo box 1 when menu A is active an dand combo box 2 when menu 2 is active.
    After starting the dashboard initial values are fine. If you then directly change to menu 2 (seeing combo box 2 with
    the correct default value) and press the reset button, the dashboard returns to the initial view, showing
    the menu 1 with the correct default value. If you now switch back  to menu 2, you will see, that the combo box 2
    is empty (i.e. nothing selected).
    I also tracked the destination cells for the combo box value results as well as the source cells for the "selected item" and the
    destination cells for the "Insert Selected Item". All this values seem to be correct. Therefore i assume that
    this is an issue of event handling. Maybe the combo box 2 does not refresh its selected value because it is already
    invisible when the values are restored.
    This case can easily be simulated by placing two combo boxes and a push button (that changes the visibility of
    the combo boxes) and the reset button on the canvas.
    Maybe someone can help. I am able to provide a test xlf, if neccessary.
    Thanks,
    Oliver
    P.S. I am using Xcelsius SP4 (Version 5.4.0.0)

    Hello Debjit_Singha_86,
    thank you for your support. At the moment i have the following setting:
    label based menu
    - General: Insertion Type "value" from a list of ID's for the menu-items to a dedicated cell (current menu ID, say tab1!$A$1)
    - Behavior: Selected item (position) fixted to item 1
    hidden combo box
    - General: Insertion Type "position" to a dedicated cell with the current choice (say tab1!$B$1)
    - Behavior: Selected item (position) to the same cell (tab1!$B$1)
    Can you give me a hint on how to connect the two components according to your solution, so that the label based menu sets the default for the hidden combox box only in case, that the reset button is pressed?
    Thanks,
    Oliver

  • Problem with Check box in WAD

    Hi ,
    I am creating a Check box in WAD which is a selection variable for a characteristic. I am able to get the display of all the values listed.
    Problem is : I want to have the list of values displayed with a check mark and I am not able to see where to make this setting in WAD.
    Any suggestions....
    Thanks

    Hello Raj
    Given the fact that you do not tell us the most important piece of information (namely whether you are using OO-based ALV or not) I assume you are using fm-based ALV lists.
    In this case you probably have defined a USER_COMMAND routine as described in the documentation of the fm.
    FORM user_command  USING r_ucomm LIKE sy-ucomm
                             rs_selfield TYPE slis_selfield.
    * define local data
      DATA: ls_outtab  LIKE LINE OF gt_outtab,
                ld_idx       TYPE i.
      LOOP AT gt_outtab INTO ls_outtab
                     WHERE ( chkbox = 'X' ).
        ld_idx = syst-tabix.
        " Call your update function / method / perform
       ls_outtab-chkbox = space.
       MODIFY gt_outtab FROM ls_outtab INDEX ld_Idx
          TRANSPORTING chkbox.
      ENDLOOP.
    " And now trigger refresh of the ALV display:
      rs_selfield-refresh = 'X'.  " <<< !!!
    ENDFORM.
    Regards
      Uwe

Maybe you are looking for

  • Choppy videos on Macbook Pro

    Hi, Ever since I updated to mountain lion on my macbook pro 13 inch. All the videos that contain adobe flash player has been choppy. Please Help!

  • Help using multiple Time Capsules

    I'm new to the Time Capsule and it's features, but my sister had one, then two and now three - all purchased to be dedicated to three different computers.  She had to purchase more then one because she needed more capacity than one would hold.  She i

  • How to clear the down payment against the vendor invoice in the payment program?

    A down payment is made $25 Later an invoice is posted for $100 Now i want to Pay $75 to Vendor But the Automatic payment program  is not clearing the down payment against the vendor invoice. Could you please help how to clear the down payment against

  • IPhoto Book with Missing Pictures

    I submitted this problem via the Apple support site but have not received an answer. I am hoping someone visiting this forum might have advice. I ordered a 50-page hardcover 8.5x11 iPhoto Book (theme: Modern Lines) that I created using iPhoto 6.0 on

  • Differences between versions

    Hi there, I'm tasked with creating standard documentation for how we develop our product on an Oracle platform. One of the tasks is to list differences between Oracle 7, 8 and 9 - we have customers on all three versions and the documentation is targe