Can JOptionPane produce an editable JComboBox?

Can I use JOptionPane for an input dialog component with a data input area represented by an editable JComboBox ?
For example :
JOptionPane.showInputDialog( parent,
� How Much?�,
�This is the title�,
JOptionPane.QUESTION_MESSAGE,
null,
new Object[]
{ � �, �un peu�,�beaucoup�,�passionnement�},
�passionnement�);
This one statement produces the input dialog I want, except that it does not allow an input such as �pas du tout� which is not in the list of selections.
Does any one knows if somehow I could get to this JComboxBox and make it editable? (still using JOptionPane of course)?
Thank you to any one who can answer me.

Hi,
You could use the JOptionPane.showMessageDialog() in the following way:
JComboBox comboBox = //Make your own JComboBox here
Object[] message = new Object[] {
"Make your choice:",
comboBox
JOptionPane.showMessageDialog(parent, message);
In this way you are able to add every Component to your message dialog you want to.
Hope that helps, Mathias

Similar Messages

  • How can I use a FocusEvent to distinguish among editable JComboBoxes?

    Hi,
    I have a Frame with multiple editable JComboBoxes, but I am at a loss as to how to sort them out in the focusGained() method.
    It is easy when they are not editable, because the FocusEvent getSource() Method returns the box that fired the event. That lets me read an instance variable that is set differently for each box.
    But with editable boxes, the FocusEvent is not fired by the box. It is fired by a Component object returned by getEditor().getEditorComponent(). So far I cannot find a way to query that object to find the box it it tied to. (I hope this isn't going to be painfully embarassing.).
    Anyway, the code below produces a frame with four vertical components: a JTextField (textField), a NON-Editable JComboBox (comboBox1) and two Editable JComboBoxes (comboBox2 & comboBox3).
    This is the command screen produced by :
    - Running the class
    - Then tabbing through all the components to return to the text field.
    I am not sure why, but it gives the last component added the foucus on startup.Focus Gained - Begin: *****
       This is the comboBox that Is Not Editable
    Focus Gained - End: *******
    Focus Gained - Begin: *****
       This Is The TextField
    Focus Gained - End: *******
    Focus Gained - Begin: *****
       Class: class javax.swing.plaf.metal.MetalComboBoxEditor$1
       Name: javax.swing.plaf.metal.MetalComboBoxEditor$1
    Focus Gained - End: *******
    Focus Gained - Begin: *****
       Class: class javax.swing.plaf.metal.MetalComboBoxEditor$1
       Name: javax.swing.plaf.metal.MetalComboBoxEditor$1
    Focus Gained - End: *******
    Focus Gained - Begin: *****
       This is the comboBox that Is Not Editable
    Focus Gained - End: *******
    Focus Gained - Begin: *****
       This Is The TextField
    Focus Gained - End: *******As you can see, the FocusEvent source for both editable boxes is a MetalComboBoxEditor. Both have identical names.
    Can anyone help me get from there back to the actual combo box so I can read the instance variable to see which one fired the event?
    The (painfully tedious and inelegant ) code that produced the above output is:import java.awt.*;
    import java.awt.event.*;
    import java.util.*;
    import javax.swing.*;
    import javax.swing.event.*;
    public class TestListeners extends JFrame
      implements ActionListener, DocumentListener,
                             FocusListener,  ItemListener {
      // Constructor
       TestListeners () {
          super ();
          panel.setLayout (new GridLayout (4, 1));
          textField.addActionListener (this);
          textField.getDocument ().addDocumentListener (this);
          textField.addFocusListener (this);
          panel.add(textField);
          comboBox2.addActionListener (this);
          comboBox2.getEditor().getEditorComponent ().addFocusListener (this);
          comboBox2.addItemListener (this);
          comboBox2.setEditable (true);
          panel.add (comboBox2);
          comboBox3.addActionListener (this);
          comboBox3.getEditor().getEditorComponent ().addFocusListener (this);
          comboBox3.addItemListener (this);
          comboBox3.setEditable (true);
          panel.add (comboBox3);
          comboBox1.addActionListener (this);
          comboBox1.addFocusListener (this);
          comboBox1.addItemListener (this);
          comboBox1.setEditable (false);
          panel.add (comboBox1);
          this.getContentPane ().add(panel);
          this.setVisible (true);
          pack ();
       // Nested class
        public class CB extends JComboBox {
           // Nested Constructor
          public CB  (Vector items, String str) {
             super (items);
             this.type = str;
          public String type;
       // Instance Members
       JTextField     textField = new JTextField ("Test Listener TextField");
       JPanel panel  = new JPanel ();
       String[] str = {"one", "two", "three"};
       Vector items = new Vector (Arrays.asList (str));
       CB comboBox1 = new CB (items, "Is Not Editable");
       CB comboBox2 = new CB (items, "Is Editable 2");
       CB comboBox3 = new CB (items, "Is Editable 3");
       // Methods
       public static void main(String args[]) {
          TestListeners frame = new TestListeners ();
       public void actionPerformed (ActionEvent ae) {
          System.out.print ("ActionEvent: This is ");
           if (ae.getSource ().getClass () == CB.class) {
             System.out.print ( ((CB) ae.getSource ()).type + " ");
          System.out.println (" "+ae.getActionCommand() + "\n" );
       public void focusGained (FocusEvent fge) {
          System.out.println ("Focus Gained - Begin: ***** ");
          if (fge.getSource ().getClass () == CB.class) {
          System.out.println ( "   This is the comboBox that "+((CB) fge.getSource ()).type);
          } else if (fge.getSource ().getClass () == JTextField.class) {
             System.out.println ( "   This Is The TextField");
         } else {
             System.out.println ("   Class: "+fge.getSource ().getClass());
             System.out.println ("   Name: "+fge.getSource ().getClass ().getName ());
         System.out.println ("Focus Gained - End: *******\n*\n");
       public void focusLost (FocusEvent fle) { }
       public void changedUpdate (DocumentEvent de) { }
       public void insertUpdate (DocumentEvent de) { }
       public void removeUpdate (DocumentEvent de) { }
       public void itemStateChanged (ItemEvent ie) { }
    }

    I added the following in your focusGained() method and it seemed to work:
    Component c = ((Component)fge.getSource ()).getParent();
    if (c instanceof JComboBox)
         JComboBox cb = (JComboBox)c;
         System.out.println("Selected: " + cb.getSelectedItem());
    }

  • How can I export an edited image to a file?

    I can't seem to find a way in iPhoto 09 do this. Can I export an edited image to a file, keeping the edits intact, or do I have to use a 3rd party editing app when I edit from inside iPhoto 09?
    I would prefer to use iPhoto's editing tools so should I import previously cropped images into iPhoto? If yes, what file should I use? I was wondering if anyone does this on a regular basis and if there issues doing this.
    I like the editing tools in iPhoto very much. In other apps I have always cropped, resized, corrected levels and a bit of color. I am not a power user by any means and I am close to doing this all in iPhoto if I could only export the edited image to a file.
    The reason I want to do this is because the printing portion of my work flow is to upload files to my merchant who prints them and are ready for nearby pickup within an hour. This is all done at a very reasonable price and the color accuracy is very close.
    Any advice would be greatly appreciated.
    Regards,
    Jim

    You can edit from iPhoto by dragging to the desktop or exporting using the File -> Export command, setting the Kind to anything except original.
    But you probably don’t need to:
    There are many, many ways to access your files in iPhoto:
    *For Users of 10.5 Only*
    You can use any Open / Attach / Browse dialogue. On the left there's a Media heading, your pics can be accessed there. Apple-Click for selecting multiple pics.
    Uploaded with plasq's Skitch!
    You can access the Library from the New Message Window in Mail:
    Uploaded with plasq's Skitch!
    *For users of 10.4 and 10.5* ...
    Many internet sites such as Flickr and SmugMug have plug-ins for accessing the iPhoto Library. If the site you want to use doesn’t then some, one or any of these will also work:
    To upload to a site that does not have an iPhoto Export Plug-in the recommended way is to Select the Pic in the iPhoto Window and go File -> Export and export the pic to the desktop, then upload from there. After the upload you can trash the pic on the desktop. It's only a copy and your original is safe in iPhoto.
    This is also true for emailing with Web-based services. However, if you're using Gmail you can use iPhoto2GMail
    If you use Apple's Mail, Entourage, AOL or Eudora you can email from within iPhoto.
    If you use a Cocoa-based Browser such as Safari, you can drag the pics from the iPhoto Window to the Attach window in the browser.
    *If you want to access the files with iPhoto not running*:
    Create a Media Browser using Automator (takes about 10 seconds) or use this free utility Karelia iMedia Browser
    Other options include:
    1. *Drag and Drop*: Drag a photo from the iPhoto Window to the desktop, there iPhoto will make a full-sized copy of the pic.
    2. *File -> Export*: Select the files in the iPhoto Window and go File -> Export. The dialogue will give you various options, including altering the format, naming the files and changing the size. Again, producing a copy.
    3. *Show File*: Right- (or Control-) Click on a pic and in the resulting dialogue choose 'Show File'. A Finder window will pop open with the file already selected.
    Regards
    TD

  • Can't click inside editable region in template based HTML document in CS5

    Hi Everyone,
    I m having a strange problem in Dreamweaver Cs5. After making the html page based on template, when i am opening the HTML page to edit content in editable region, I couldnot click inside the editable region. I can make changes in code view but not in design view in Dreamweaver Cs5.
    Please help if anyone knows the solution. It is really creating a mess for me.
    Thanks,
    Komal

    One of the sites is www.ShelbyVideo.com.
    The code for one of the pages is:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/index.dwt" codeOutsideHTMLIsLocked="false" -->
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <!-- InstanceBeginEditable name="doctitle" -->
    <meta name="description" content="SHELBY VIDEO SERVICES: Shelby, NC Video services that are inexpensive, professional, and thorough! Offering corporate and wedding video production services in and around Shelby North Carolina and South Carolina." />
    <meta name="keywords" content="shelby video, shelby videographer, shelby videography, shelby nc video, north carolina shelby video, shelby video camera, shelby videos, north carolina videos, nc video, shelbyvideo, shelbyvideo.com, shelby video production, shelby video services, cleveland county video, cleveland county wedding video" />
    <title>Shelby Video Production Services: SheblyVideo.com offering videography services in the Carolinas.</title><!-- InstanceEndEditable -->
    <link href="css/main.css" rel="stylesheet" type="text/css" media="projection,screen" />
    <!-- InstanceBeginEditable name="head" -->
    <!-- InstanceEndEditable -->
    </head>
    <body class="body">
    <div id="wrapper">
      <div id="header">
        <p><a href="http://www.shelbyvideo.com"><img src="images/shelby-video-logo.jpg" alt="Shelby Video Services" name="weddingVideo" width="216" height="77" border="0" id="weddingVideo" /></a></p>
        <p><a href="index.html">HOME</a>   <a href="shelby-nc-video-services.html">SHELBY VIDEOS</a>   <a href="shelby-video-demos.html">DEMOS</a>   <a href="shelby-video-prices.html">PRICES</a>   <a href="shelby-video-faqs.html">FAQ'S</a>   <a href="shelby-video-north-carolina-reviews-testimonials.html">TESTIMONIES</a>   <a href="shelby-video.html">BOOK US</a></p>
      </div>
      <div id="mainContent"><!-- InstanceBeginEditable name="CONTENT" --><br />
        <h1>ShelbyVideo.com</h1>
        <div id="carolinaWeddingVideoDiv">
          <object width="300" height="182">
              <param name="movie" value="http://www.youtube.com/v/QUSnPSLdnG0&amp;hl=en&amp;fs=1&amp;" />
              </param>
              <param name="allowFullScreen" value="true" />
              </param>
              <param name="allowscriptaccess" value="always" />
              </param>
              <embed src="http://www.youtube.com/v/QUSnPSLdnG0&amp;hl=en&amp;fs=1&amp;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="300" height="182"></embed>
          </object>
        Shelby Video Demo</div>    <p> </p>
        <p>Welcome to  Shelby Video Services. We have been producing  videos in Shelby North Carolina and South Carolina since 2004. </p>
        <p> </p>
        <p>Your video will be professional and comprehensive. We will beautifully cover your video production in a way that will propell your business into your market and/or enable you to relive your special event over and over and enjoy sharing with others.</p>
        <p> </p>
        <p> </p>
        <p> </p>
      <!-- InstanceEndEditable --></div>
      <div id="footer">© <a href="index.html">Shelby  Video Services</a><br />
      <a href="shelby-nc-video-services.html">shelby nc video services</a> | <a href="shelby-video.html">start here</a> | <a href="shelby-video-demos.html">demos</a> | <a href="links.html">links</a> | <a href="sitemap.html">site map</a> | <a href="shelby-video.html">contact</a> | <a href="shelby-video-north-carolina-reviews-testimonials.html">testimonials</a></div>
    </div>
    <script type="text/javascript">
    var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
    document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
    </script>
    <script type="text/javascript">
    try {
    var pageTracker = _gat._getTracker("UA-9484651-2");
    pageTracker._trackPageview();
    } catch(err) {}</script>
    </body>
    <!-- InstanceEnd --></html>
    Because I didn't create the code, rather it was dreamweaver, i believed that DW is obviously broken. Because I have a bunch of sites I made in earlier versions and when I start using a newer versions, CS5, I now can't access the editable region in any of them it seems DW is broken. So, I didn't think the code was necessary. I thought it was something that others have already experienced and resolved. However, that doesn't seem to be the case. Thanks though for helping with what appears to be broken. Hopefully it's an easy fix because there's other sites I have that this annoyance is plaguing me...

  • Editable JComboBox -Saving itz new value in the database.

    Hi,
    I have a Combobox say Product , in which some fields (like -> tv , hand blender etc) comes from Database and i have added one more field say others ,
    in others field user can enter new product name and it shd be saved in the same database, i have used editable jcombobox but dnt no how to proceed further.
    Thanks & Regards
    Komal

    And make a provision to delete wrong entries, or you'll end up with all the typos stored separately.
    I speak from experience. I actually have such a combo in several of my VFP applications (not in Java though)
    db

  • Blank values for editable JComboBox

    Hello,
    I have a editable JComboBox that the user can erase its current value and if they simple change focus (like click on a text field on the same panel) the combo box is left blank. i would like to have it so that if the user leaves focus of the box and its blank that current value goes back to what it was before they erased it.
    Many thanks,
    Jonathan

    import java.awt.FlowLayout;
    import java.awt.event.FocusEvent;
    import java.awt.event.FocusListener;
    import java.awt.event.ItemEvent;
    import java.awt.event.ItemListener;
    import javax.swing.JButton;
    import javax.swing.JComboBox;
    import javax.swing.JFrame;
    import javax.swing.SwingUtilities;
    public class NonBlankCombo {
       JComboBox comboBox;
       Object previousContent;
       void makeUI() {
          Object[] data = {"One", "Two", "Three", "Four", "Five"};
          previousContent = data[0];
          comboBox = new JComboBox(data);
          comboBox.setEditable(true);
          comboBox.addItemListener(new ItemListener() {
             public void itemStateChanged(ItemEvent e) {
                if (e.getStateChange() == ItemEvent.SELECTED
                      && !((String) comboBox.getSelectedItem()).trim().isEmpty()) {
                   previousContent = comboBox.getSelectedItem();
          comboBox.getEditor().getEditorComponent().addFocusListener(new FocusListener() {
             public void focusGained(FocusEvent e) {
                previousContent = comboBox.getSelectedItem();
             public void focusLost(FocusEvent e) {
                if (((String)comboBox.getSelectedItem()).trim().isEmpty()) {
                   comboBox.setSelectedItem(previousContent);
          JFrame frame = new JFrame("Non-blank Combo");
          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          frame.setSize(200, 100);
          frame.setLayout(new FlowLayout());
          frame.add(comboBox);
          frame.add(new JButton("Click"));
          frame.setLocationRelativeTo(null);
          frame.setVisible(true);
       public static void main(String[] args) {
          SwingUtilities.invokeLater(new Runnable() {
             public void run() {
                new NonBlankCombo().makeUI();
    }db

  • Editable JComboBox in a JTable

    I posted my problem into the "Java Essentials/Java programming" forum but it would be much better if I'd posted it here into the swing theme :).
    Here it is what I posted:
    Funky_1321
    Posts:8
    Registered: 2/22/06
    editable JComboBox in a JTable
    Oct 21, 2006 1:32 PM
    Click to email this message
    Hello!
    Yesterday I posted a problem, solved it and there's another one, referring the same theme.
    So it's about a editable JComboBox with autocomplete function. The combo is a JTables cellEditors component. So it's in a table. So when the user presses the enter key to select an item from the JComboBox drop down menu, I can't get which item is it, not even which index has the item in the list. If for exemple the JComboBox isn't in a table but is added on a JPanel, it works fine. So I want to get the selectedItem in the actionPerformed method implemented in the combo box. I always get null instead of the item.
    Oh... if user picks up some item in the JComboBox-s list with the mouse, it's working fine but I want that it could be picked up with the enter key.
    Any solutions appreciated!
    Thanks, Tilen
    YAT_Archivist
    Posts:1,321
    Registered: 13/08/05
    Re: editable JComboBox in a JTable
    Oct 21, 2006 1:55 PM (reply 1 of 2)
    Click to email this message
    I suggest that you distill your current code into a simple class which has the following attributes:
    1. It can be copied and pasted and will compile straight out.
    2. It has a main method which brings up a simple example frame.
    3. It's no more than 50 lines long.
    4. It demonstrates accurately what you've currently got working.
    Without that it's hard to know exactly what you're currently doing, and requires a significant investment of time for someone who hasn't already solved this problem before to attempt to help. I'm not saying that you won't get help if you don't post a simple demo class, but it will significantly improve your chances.
    Funky_1321
    Posts:8
    Registered: 2/22/06
    Re: editable JComboBox in a JTable
    Oct 21, 2006 2:11 PM (reply 2 of 2)
    Click to email this message
    Okay ... I'll write the code in short format:
    class acJComboBox extends JComboBox {
      public acJComboBox() {
        this.setEditable(true);
        this.setSelectedItem("");
        this.getEditor().getEditorComponent().addKeyListener(new KeyAdapter() { public void keyReleased(KeyEvent e) {
         // ... code code code
         // that's tricky ... the method getSelectedItem() always returns null - remember; the acJComboBox is in a JTable!
         if (e.getKeyCode() == 10 && new String((String)getEditor().getItem()).length() != 0) { getEditor().setItem(getSelectedItem()); }
    }And something more ... adding the acJComboBox into the JTable:
    TableColumn column = someTable.getColumn(0);
    column.setCellEditor(new DefaultCellEditor(new acJComboBox());
    So if the user presses the enter key to pick up an item in the combo box drop down menu, it should set the editors item to the selected item from the drop down menu (
    getEditor().setItem(getSelectedItem());
    When the acJComboBox is on a usual JPanel, it does fine, but if it's in the JTable, it doesn't (getSelectedItem() always returns null).
    Hope I described the problem well now ;).

    Okay look ... I couldn't write a shorter code just for an example. I thought that my problem could be understoodable just in mind. However ... type in the first combo box the letter "i" and then select some item from the list with pressing the enter key. Do the same in the 2nd combo box who's in the JTable ... the user just can't select that way if the same combo is in the JTable. Why? Thanks alot for future help!
    the code:
    import java.awt.event.KeyAdapter;
    import java.awt.event.KeyEvent;
    import java.awt.event.MouseAdapter;
    import java.awt.event.MouseEvent;
    import java.util.Vector;
    import javax.swing.DefaultCellEditor;
    import javax.swing.DefaultComboBoxModel;
    import javax.swing.JComboBox;
    import javax.swing.JFrame;
    import javax.swing.JScrollPane;
    import javax.swing.JTable;
    import javax.swing.JTextField;
    import javax.swing.table.DefaultTableModel;
    import javax.swing.table.TableColumn;
    class Example extends JFrame {
        private String[] columns = { "1", "2", "3" };
        private String[][] rows = {};
        private DefaultTableModel model = new DefaultTableModel(rows, columns);
        private JTable table = new JTable(model);
        private JScrollPane jsp = new JScrollPane(table);
        private acJComboBox jcb1 = new acJComboBox();
        private acJComboBox jcb2 = new acJComboBox();
        public Example() {
            // initialize JFrame
            this.setLayout(null);
            this.setLocation(150, 30);
            this.setSize(300, 300);
            this.setDefaultCloseOperation(EXIT_ON_CLOSE);
            // initialize JFrame
            // initialize components
            Vector<String> v1 = new Vector<String>();
            v1.add("item1");
            v1.add("item2");
            v1.add("item3");
            jcb1.setData(v1);
            jcb2.setData(v1);
            jcb1.setBounds(30, 30, 120, 20);
            jsp.setBounds(30, 70, 250, 100);
            add(jcb1);
            add(jsp);
            TableColumn column = table.getColumnModel().getColumn(0);
            column.setCellEditor(new DefaultCellEditor(jcb2));
            Object[] data = { "", "", "" };
            model.addRow(data);
            // initialize components
            this.setVisible(true);
        public static void main(String[] args) {
            Example comboIssue = new Example();
    class acJComboBox extends JComboBox {
        private Vector<String> data = new Vector<String>();
        private void init() {
            this.setEditable(true);
            this.setSelectedItem("");
            this.setData(this.data);
            this.getEditor().getEditorComponent().addKeyListener(new KeyAdapter() { public void keyReleased(KeyEvent e) {
                        if (e.getKeyCode() != 38 && e.getKeyCode() != 40) {
                            String a = getEditor().getItem().toString();
                            setModel(new DefaultComboBoxModel());
                            int st = 0;
                            for (int i = 0; i < getData().size(); i++) {
                                String str1 = a.toUpperCase();
                                String tmp = (String)getData().get(i).toUpperCase();
                                if (str1.length() <= tmp.length()) {
                                    String str2 = tmp.substring(0, str1.length());
                                    if (str1.equals(str2)) {
                                        DefaultComboBoxModel model = (DefaultComboBoxModel)getModel();
                                        model.insertElementAt(getData().get(i), getItemCount());
                                        st++;
                            getEditor().setItem(new String(a));
                            JTextField jtf = (JTextField)e.getSource();
                            jtf.setCaretPosition(jtf.getDocument().getLength());
                            hidePopup();
                            if (st != 0 && e.getKeyCode() != 10 && new String((String)getEditor().getItem()).length() != 0) { showPopup(); }
                            if (e.getKeyCode() == 10 && new String((String)getEditor().getItem()).length() != 0) { getSelectedItem(); }
                            if (new String((String)getEditor().getItem()).length() == 0) { whenEmpty(); }
            this.addMouseListener(new MouseAdapter() { public void mouseReleased(MouseEvent e) {
                hidePopup();
        // - constructors -
        public acJComboBox() {
            init();
        public acJComboBox(Vector<String> data) {
            this.data = data;
            init();
        // - constructors -
        // - interface -
        public void whenEmpty() { } // implement if needed
        public void setData(Vector<String> data) {
            this.data = data;
            for (int i = 0; i < data.size(); i++) {
                this.addItem(data.get(i));
        public Vector<String> getData() {
            return this.data;
        // - interface -
    }

  • Can we produce a newsletter in one CS4 application and output it to both print and the web?

    Can we produce a newsletter in one CS4 application and output it to both print and the web?
    If so what do you suggest that we use?
    Message was edited by: [email protected]

    A very cautious "yes". It mainly depends on what you expect.
    It has always been possible to just export to PDF and post that on your site. You can also export your ID file as one comprehensive SWF file and immediately put that onto the site -- it comes with a few handy browse functions, snazzy page flipping (when required); and it looks exactly like your ID document.
    Hard-core techies can use the Export To XHTML/DreamWeaver function, but that will only export the very bare bones -- plain text, with just the commands for text formatting in place. You have to re-do layout and styling in HTML code. Bear in mind ID is designed, top to bottom, as a document layout program, and this export is "extra", not really a basic feature.

  • How to create full editable JComboBox  ?

    I need to create full editable comboBox -- i want to do it by extends the class JComboBox - but i dont realy know how to collect the chars that the user will be insert and show then on the control.
    Does someone know where can i find some example of editable JComboBox ?
    Thanks.

    JComboBox can already be made editable, so you need to clarify what exactly you mean by "full editable"
    Recommended reading: The Java&#8482; Tutorials: How to use Combo Boxes: [Using an Editable Combo Box|http://java.sun.com/docs/books/tutorial/uiswing/components/combobox.html#editable]
    db

  • Editable JComboBox inside JTable clipping issues

    Here is an example of what I am talking about
    http://img95.imageshack.us/img95/9514/clipping4fw.png
    As you can see, the bottom of the editable JComboBox is being clipped. Is there any way to remove what looks like the invisible border there?
    Thanks
    Daniel

    I am not sure if I understand your question exactly. Your table's row height is not high enough so you may need to add a line of code like:
            table.setRowHeight(table.getRowHeight() + 4);to solve your problem.

  • Can I produce a new sequence in Premiere Elements 7

    I bought Premiere Elements 7 with 15 class licences for my students.
    I really admire the Elements 7 and very happy to be able to present this affordable and yet so efficient program to my students.
    There's only one thing I really miss: how can I produce a second timeline? (sequence)
    I normaly have my raw material in one timeline (sequence), there I sight it and chose pieces I need for my film, I cut them out, copy and paste in another timeline (sequence), which I sometimes rename to: master
    I hope I just can't find it.
    Please help me to find it.
    Thank you

    Welcome to the forum.
    Unfortunately, PrE, unlike PrPro, does not have Sequences. As I normally use PrPro, I feel that this is a big loss, but considering the differences in the two programs, I can see why Adobe chose to not include Sequences.
    Now, there are at least two ways to do similar:
    1.) Edit your Project, exactly as you want, and then Export/Share that Project as a DV-AVI Type II file. Import that AV file into a new Project.*
    2.) Many have used ClipMate, a Clipboard "extender," to Copy/Paste between two Projects. I have not used it, so I do not know the power, or the limitations.
    Good luck,
    Hunt
    * One workflow is to do a very tight edit, with all cuts and Transitions, as changing things like a simple Transition can be a bit more work, and require extra Trimming, just to swap out a Cross-Dissolve for another Transition. The other is to do a very loose edit, leaving the Clips with plenty of additional footage, so you will have the necessary Handles. For this, I would go so far as to place 02 sec. of Black Video between each Clip, so I could easily find where I will want to Trim later. It's either a tight, final edit, or a very loose one.

  • JTable with editable JComboBoxes

    For some reason once I added editable JComboBoxes to a JTable I can no longer tab among the fields in the table. If I just select a cell, I can tab to the other cells in that row, and then to proceeding rows as I reach the end of each. However if I double click the cell and enter data or select from the combobox. I no longer can tab to the next cell. At that point once I do hit tab, I am taken to the next table. Not the next cell in the row, or the next row in the current table.
    I have tried messing with a bunch of listeners, but I am not using the right listener on the right object? What listerner and object should the listener belong to? Table, model, cell editor, combobox, jpanel, jframe ? I hope this is not to vague.

    Well I am starting to think it's an implementation issue. Like I am not doing it how I should. I am basically doing
    JComboBox jcb = new JComboBox();
    jcb.setEditable(true);
    column.setCellEditor(new DefaultCellEditor(jcb));
    When I think I should be inheriting, and creating my own editor and/or renderer? Now my combobox vars are globally available in the class, so I can set and clear their contents. It does not matter that each row in the table has the same content in the combo boxes, that's basically what I want. User to be able to select an existing entry or make a new one.
    What I am trying to do is on tables have a drop down box that shows up when a user types a matching entry. If no entry matches, no popup box. If entry matches, box pops up and shows possible entries starting with what they are typing. Like code completion in IDE's like Netbeans. However I am doing this in a table. I thought a JComboBox would be a good widget to start with?

  • My Microsoft Word for Mac hasn't worked since I downloaded Yosemite. documents can't be save, edited or closed

    My Microsoft Word for Mac hasn't worked since I downloaded the upgrade to Yosemite.  Documents can't be saved, edited or closed

    Hi There,
    I have similar issues with the whole MS Office solution since I "upgraded' towards Yosemite:
    when I use Cmd+W or the "close" menu option to close a Word file, Word crashes down (I always send a message to Microsoft but I guess this is more related to Yosemite or to its installation; consequence is it become very difficult to close a file, as it re-opens it the next time :-(
    same thing for Excel and PowerPoint
    When I try to save in PDF format a Word file containing several sections, it produces one PDF file per section - wasn't before Yosemite
    Excel crashes down much more often than before because of lack of memory
    Well, if someone has a suggestion, I would be grateful, 'cause it is becoming actually boring - and counter-productive !

  • Update the testfield when setSelectedItem() for editable JComboBox

    Hi,
    I am having problem with setSelectedItem() and setSelectedIndex() methods of editable JComboBox.
    I extended JComboBox with default dataModel. When I enter some string in the textfield of the combobox, I call insertItemAt() method to dynamically grow the list. The application requires to clear the textfield everytime I enter something and press "return" key. To make it work, I insert an empty string to the list at the very beginning and call the setSelectedItem("") method in the actionPerformed().
    Now the problem is that I know the setSelectedItem("") is called since the getActionCommand() returns "comboBoxChanged" everytime I enter something in the textfield, but the testfield is not cleared. And if I select one item from the list and press "enter" key, the textfield is cleared. To make things more interesting, after I enter the first string and press "enter", the textfield really get cleared, but not for all other later input. Is this a bug? Can anyone please help me? Thanks a lot. Below is my code snippet.
    public class MyComboBox extends JComboBox implements ActionListener
    public GsISCommComboBox()
    jbInit();
    private void jbInit() throws Exception
    this.setEditable(true);
    this.addActionListener(this);
    insertItemAt("",0);
    public void actionPerformed(ActionEvent e)
    String str=null;
    String strrr=e.getActionCommand();
    System.out.println("getActionCommand: "+strrr);
    if(strrr.equalsIgnoreCase("comboBoxChanged"))
    str=(String)this.getSelectedItem();
    return;
    else
    str=strrr;
    // other stuff to process the string and do things
    setSelectedItem("");
    repaint();
    hidePopup();
    insertItemAt(str,0);

    Try inserting your string first and then, try clearing the combobox's textfield.
    insertItemAt(str,0);
    setSelectedItem("");
    hidePopup();
    repaint();
    Since you add the "" string at the begining, it will have the index 0. Perhaps, you want to insert your string this way:
    // insert string at the end
    insertItemAt(str, this.getItemCount());
    //Then use the
    setSelectedIndex(0);
    But you need to remember that if you add an item at the begining, index 0 may not be your '' '' string after that.
    I hope that it helps.

  • A simple quesiton about editable JComboBox

    Hi...
    I have a editable JCombobox in a JFrame, when the JFrame first open I want the cursor in the JComboBox's editor(text field) and allow the user input value, I used the method requestFocus() of JComboBox, but it just put the focus in the Arrow Button of the JComboBox(not put the cursor in the JComboBox's editor), and the user can not input value.
    So anybody can help me that how to set the postion of the cursor in the JComboBox's editor?
    Thanks in advance!
    lupeng
    [email protected]

    See if this helps .....
         JComboBox c= new JComboBox(){
    public void grabFocus() {
         super.grabFocus();
         getEditor().getEditorComponent().requestFocus();
         c.setEditable(true);
    c.grabFocus();
    //panel.add(c);

Maybe you are looking for