Question about drop down lists from JComboBox within an applet

When I click on the down arrow of a standard JComboBox in an applet and the list of strings are displayed, if I then drag the browser window, the drop down list stays in the same place instead of either being closed or moving with the browser window. I started noticing this when I started using Java 7, but I think this also occurs with Java 6 and 5. When run within the applet viewer in Eclipse, moving the applet window there closes the drop-down during the process of moving the window. Anybody else noticing this If so are any suggestions for a possible solution. Ideally I'd want the list to move with the browser window without the drop-down closing.

My example code that demonstrates the problem is as follows:

import javax.swing.JApplet; import javax.swing.JComboBox; public class ComboApplet extends JApplet { public void init () { String [] testStrings = new String [] {"This", "is", "a", "test"}; JComboBox comboBox = new JComboBox(testStrings); add(comboBox); } }

Posted On: Friday 21st of September 2012 11:01:20 PM Total Views:  276
View Complete with Replies

Related Messages:

problem with jcombobox   (360 Views)
hey you all, i have combobox with big list and when i drag the list back and forth the list get messed up. what i have to do in order to avoid this
Another MVC question   (164 Views)
I think I am starting to get the idea of how to implement an MVC pattern, I just have a few questions on the specific details for my current project. Currently I'm working on a project that is a simple single frame (that will change later) quiz GUI to quiz a user on Karate terms. I have a Model, View and Controller and I also have QuizQuestion and KarateTerm Objects. My model is gathering a list of KarateTerms from a text file and then I want it to generate a random question with random answers along with the correct answer. I'm getting a little confused as to how to break the processes up. I guess my first roadblock is which logic goes where.... So my model creates a question and updates the view, then the user makes a selection, the controller sees it and sends that selected answer to the model. Would the model then check if the answer is correct or should that logic be in the Question Object Here is the entire code so far, if anyone feels ambitious enough to check it over can you tell me what your initial thoughts are on my structure I know my View is very simple and ugly but I only created it to test my model and I see there are flaws with it but I'm not sure how to proceed. package karatetutor; /** * * @author Geoff Berl * Date Created: * Date last Modified: */ public class KarateTerm { private String japaneseTerm, englishTerm; /** * Two Args constructor. This constructor creates a KarateTerm * @param japaneseTerm the Japanese term for this KarateTerm * @param englishTerm the English translation of this KarateTerm */ public KarateTerm(String japaneseTerm, String englishTerm) { this.japaneseTerm = japaneseTerm; this.englishTerm = englishTerm; } /** * Get the English translation of this KarateTerm * @return */ public String getEnglishTerm() { return englishTerm; } /** * Get the Japanese term for this KarateTerm * @return a string representation of the Japanese term for this KarateTerm */ public String getJapaneseTerm() { return japaneseTerm; } /** * @see Object */ @Override public String toString() { return japaneseTerm; } }
applet spawn new jvm   (269 Views)
i have an applet application that runs from signed jar files on the local machine. I have a need for the applet to spawn a new jvm instance, one that will survive the original applet instance execution. help thoughts
Confusion about this reference to a JFrame   (207 Views)
import java.awt.*; import javax.swing.*; public class SimpleScreenManager{ private GraphicsDevice device; SimpleScreenManager(){ GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); device = ge.getDefaultScreenDevice(); } public void setFullScreen(DisplayMode displayMode, JFrame window){ window.setUndecorated(true); window.setResizable(false); device.setFullScreenWindow(window); //test if displayMode has parameters passed to it and change mode is supported if(displayMode != null && device.isDisplayChangeSupported()){ try{ device.setDisplayMode(displayMode); } catch (IllegalArgumentException ex){ //ignore illegal mode for this device } } } public Window getFullScreenWindow (){ return device.getFullScreenWindow(); } public void restoreScreen(){ Window window = device.getFullScreenWindow(); if(window!=null){ window.dispose(); } device.setFullScreenWindow(null); } } import java.awt.*; import javax.swing.*; public class FullScreenTest extends JFrame{ public static void main(String [] args){ DisplayMode displayMode; //Checking if args were passed via the command line ie java FullScreenTest 800,600,32 if(args.length == 3){ displayMode = new DisplayMode( Integer.parseInt(args[0]), Integer.parseInt(args[1]), Integer.parseInt(args[2]), DisplayMode.REFRESH_RATE_UNKNOWN); } //setting default display settings if no args were used else { displayMode = new DisplayMode(800,600,32, DisplayMode.REFRESH_RATE_UNKNOWN); } FullScreenTest test = new FullScreenTest();; } private static final long Demo_Time = 5000; public void run(DisplayMode displayMode){ setBackground(; setForeground(Color.white); setFont(new Font("Dialog", Font.PLAIN, 24)); SimpleScreenManager screen = new SimpleScreenManager(); try { screen.setFullScreen(displayMode, this); try { Thread.sleep(Demo_Time); } catch (InterruptedException ex){} } finally { screen.restoreScreen(); } } public void paint(Graphics g){ g.drawString(" World",20,50); } }
applet automation   (187 Views)
i want to automate any applet(i.e which can be called from jnlp,jsp or servlet link). here i mean to say, i will write one program which will perform different actions on java applet (different actions like button click, setting value in text box etc). in this case i don't have access to source code of applet. currently i m trying with reflection and accessibility. Note: don't have to use Robot class.
Drag n drop recognition   (121 Views)
How to recognise the drag n drop event using tree model listener
Disable dropping feature in JSpinner   (107 Views)
Hi , I need to avoid dropping of text inside the JSpinner control. Below is my code for custom transferHandler. Even though canImport method is returning false I am able to drag and drop text into JSpinner. I searched net but did not find proper solution. Please let me know if any one is having an idea how to do it. public class DisableTranserHandler extends TransferHandler{ @Override public boolean canImport(TransferHandler.TransferSupport info) { boolean b=false; System.out.println("Returning "+b); return b; } @Override public int getSourceActions(JComponent c) { System.out.println("It is in getSourceActions"); return TransferHandler.NONE; } }
help needed for swing questions.   (291 Views)
There are 2 questions i want to ask:- 1. Explanation:- I create simple example of nested Jtabbedpane & ask question in swing section. cointainer/components size & diamentions! I try with java's default look & feel(which apply without writing specific code). Then i use open source look & feel.jtattoo For both i got different values for x,y axis. I ask their 'contact us' & got reply that the problem is that you want to get the bounds before you set the frame to visible. Bounds are calculated by the layout managers after the frame becomes visible. So base on this i create more simpler example as below import java.awt.EventQueue; import javax.swing.JFrame; import javax.swing.UIManager; import javax.swing.JTabbedPane; import java.awt.BorderLayout; import javax.swing.border.LineBorder; import java.awt.Color; import javax.swing.JPanel; public class abcd { private JFrame frame; public static void main(String[] args) { // try { // UIManager.setLookAndFeel("com.jtattoo.plaf.mcwin.McWinLookAndFeel"); // } catch (Throwable e) { // e.printStackTrace(); // } EventQueue.invokeLater(new Runnable() { public void run() { try { abcd window = new abcd(); window.frame.setVisible(true); //Location1 } catch (Exception e) { e.printStackTrace(); }}});} public abcd() { initialize(); } private void initialize() { frame = new JFrame(); frame.setBounds(0, 0, 450, 300); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //frame.setVisible(true); //Location2 JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP); tabbedPane.setOpaque(true); tabbedPane.setBackground(Color.PINK); tabbedPane.setBorder(new LineBorder(new Color(0, 0, 0), 1, true)); frame.getContentPane().add(tabbedPane, BorderLayout.CENTER); JPanel panel = new JPanel(); panel.setBackground(new Color(255, 255, 224)); tabbedPane.addTab("New tab", null, panel, null); JPanel panel_1 = new JPanel(); panel_1.setBackground(new Color(240, 255, 240)); tabbedPane.addTab("New tab", null, panel_1, null); //frame.setVisible(true); //Location3 System.out.println(UIManager.getLookAndFeel()); System.out.println("Frame getBounds =("+frame.getX()+","+frame.getY()+")"); System.out.println("Frame getLayeredPane() getbounds =("+frame.getLayeredPane().getX()+","+frame.getLayeredPane().getY()+")"); System.out.println("Frame getContentPane() getbounds =("+frame.getContentPane().getX()+","+frame.getContentPane().getY()+")"); System.out.println("tabbedPane getbounds =("+tabbedPane.getX()+","+tabbedPane.getY()+")"); System.out.println("panel getbounds =("+panel.getX()+","+panel.getY()+")"); System.out.println("panel_1 getbounds =("+panel_1.getX()+","+panel_1.getY()+")"); }} , > Now Question:- I try to understand why i got 2 different values when i place different location with & without look & feel. why do you need to know what problem does it create if there's no problem, and it's just a Julius Sumner Miller why-is-it-so, you'll need to spend more time on google. and the other topic you mentioned 'size of', has little/nothing directly to do with Swing. the people most likely to answer questions about the inner workings of a PC (heap/delta/memory-leaks etc) would be in another forum.