KeyCode problem in JSplitPane

Hi,
I have a little problem with my swing application. My aplication is like this:
A JFrame witch contains a JPanel witch contains a JSplitPane witch contains one left and one right element witch are both a JPanel with a JList with more elements in it. I used ActionMap and InputMap classes of the split to implement a TAB key action. The action was to give focus to one list at a time when the TAB key was pressed. That's fine so far, but when i tried to implement an action for the F76 key i got into problems. I used the same ActionMap-InputMap pair, but the listener isn't called, but instead it does exactly what the TAB key does:switching focus. I've noticed that there was exactly this action defined for that input map for F6. So i deleted it , but this strange thing still ocuurs. How can i force my application to do what i want on F6 and not what it wants? I don't know if this helps but: i'm using a RedHat 7.2 system (with the latest upgrades), and i didn't tested my application on other system, or other jdk than the one i'm curently using:1.3.1_01 .
Please help.
Thanks.

I used the following code
private void initMater() {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
catch(Exception e) {}
// after the look and feel is installed we override .....
Object obj = new UIDefaults.LazyInputMap(new Object[] {
          "UP", "negativeIncrement",
          "DOWN", "positiveIncrement",
          "LEFT", "negativeIncrement",
          "RIGHT", "positiveIncrement",
          "KP_UP", "negativeIncrement",
          "KP_DOWN", "positiveIncrement",
          "KP_LEFT", "negativeIncrement",
          "KP_RIGHT", "positiveIncrement",
          "HOME", "selectMin",
          "END", "selectMax"
          // "F8", "startResize", NO !
          // "F6", "toggleFocus" NO !
UIManager.put("SplitPane.ancestorInputMap",obj);

Similar Messages

  • Problem with JSplitPane

    Hi!
    I have the following problem with JSplitPane: Whenever I add two components to the splitpane and then add the splitpane to a JPanel, the left component is minimized, i.e. not visible. I always have to manually readjust the splitter in order to see the left component. I also tried a bunch of combinations of setSize, etc. but nothing seems to help.
    Here's some code:
    public void setTables(Vector<DBTable> vec)
              _panel.setSize(650, 500);
              DefaultListModel m = new DefaultListModel();
              _tableList = new JList(m);
              // _tableList.setSize(new Dimension(300, 400));
              _infoArea = new JTextArea();
              _infoArea.setEditable(false);
              // _infoArea.setSize(new Dimension(250, 300));
              MetaDataListener listener = new MetaDataListener(_infoArea, _tableList);
              _tableList.addListSelectionListener(listener);
              for (DBTable table : vec)
                   m.addElement(table);
              JScrollPane scroll1 = new JScrollPane(_tableList);
              JScrollPane scroll2 = new JScrollPane(_infoArea);
              JSplitPane split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, scroll1, scroll2);
              split.setSize(new Dimension(600, 480));
              _panel.add(split, BorderLayout.CENTER);
              scroll1.setPreferredSize(new Dimension(300, 400));
              scroll1.setSize(new Dimension(300, 400));
              scroll2.setPreferredSize(new Dimension(300, 400));
              scroll2.setSize(new Dimension(300, 400));
              _panel.setVisible(true);
                                         //_frame referes to a JInternalFrame and _panel surprisingly to a JPanel
              _frame.getContentPane().add(_panel, BorderLayout.CENTER);
              _frame.setVisible(true);
              split.setDividerLocation(50.0);
         }Thanks!

    Nevermind I fixed it!

  • Big problem with JSplitPane

    Hello,
    I feel I'm going mad with Swing.
    I have a main main JTabbedPane: main.
    First component: JEditorPane : source
    Second Component: JPanel : view( = new JPanel())
    In view I have:
    JPanel toolbox to NORTH and JSplitPane: ds to CENTER.
    In ds I have:
    Left component: new JScrollPane(design) where design=new JPanel()
    Right component: JSplitPane(....) : called pe
    First problem:
    In ds the left component is too small. I tried to use all functions available , no result. I want the right component(pe) to have width=200, but no chance. It is too big. Why?
    Second problem:
    The scrolls are not appearing on the left at the ds(JSplitPane)
    Third problem:
    I add different components to design JPanel(the one which is placed into a JScrollPane which is related to the second problem) but nothing happens. They won't appear on design which is the same and without no scrolls.
    Please help me solve this Swing mistery.
    Thank you all.

    The split pane, by default, will size its two halves based on their preferred sizes. If the combined preferred sizes are too small (for the size of the spilt pane) then the extra space is distributed based on JSplitPane's resize weight. The default is to add the extra to the right hand side, see JSplitPane.setResizeWeight for an explanation. If you really want the right hand side to be exactly 200 pixels then you can programmatically move the divider to a location that would leave the right hand side to be 200. Or you can set the preferred size of the component you place there to 200 and set a resize weight that will give the extra space to the left instead of the right.
    I am not sure about why the scroll bars are not showing up. Does it need scroll bars?
    May I suggest creating a simple demo app to show the problem? Often I solve my own problems doing this otherwise you have some code for us to look at and play with.
    Ian

  • Problem with JSplitPane.setDividerPosition

    An applet has a split panel, a list of items shown to the left and a map display to the right.
    The problem I'm getting is that the divider bar insists on starting life in the middle.
    My intialisation looks like this:
        protected void initGui() {
            Container content = getContentPane();
            JMenuBar bar = new JMenuBar();
            setupMenu(bar, MK_MENU_DATASTORE, dataStoreMenu);
            setJMenuBar(bar);
            content.setBackground(new Color(0xfffeff));
            layerList = new JPanel();
            layerList.setLayout(new BoxLayout(layerList, BoxLayout.Y_AXIS));
            layerList.add(Box.createVerticalGlue());
            mapPanel = new ViewPanel();
            JSplitPane split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, layerList, mapPanel);
            split.setDividerLocation(ViewLayer.LAYERBOX_WIDTH);
            split.validate();
            content.add(split);
            validate();
        }Now the divider location I set seems to get squirreled away somewhere, because when I click the bar with the mouse it jumps to the correct position but it refused to initialise to the right position.

    Oops! Spotted it.

  • Problems resizing JSplitPane

    I have a JSplitPane with a Canvas3D on one side. It won't allow the split pane to be resized to make the canvas smaller. It will allow the splitpane to be resized to make the canvas larger, though.
    Is there a way to fix this?
    Thanks,
    Brian.

    The solution for this problem is a little bit tricky:
    - put a JScollPane (not a ScrollPane!) to one side of the JSplitPane and set the scrollbar policies to ..._SCROLLBAR_NEVER
    - put your Canvas3D into the ViewPort of the JScrollPane
    - create a PropertyChangeListener which listens to the JScrollPane and the JSplitPane
    Now you can use the JSplitPanes but it looks ugly because the size of the Canvas3D doesn't changes. So every time a PropertyChange event occures you have to calculate the size of the Canvas3D using your JFrame's size and the JSplitPanes diver location and change the Canvas3D's size using setSize().
    Oxygenic

  • CR2008 KeyCode problem/question

    Hello everyone,
    I have Visual Studio 2008 SP1 and I just bought the upgrade version of Crystal Reports 2008. I installed the CR2008 without any problems. Every time I open Crystal Reports 2008 by clicking in All Programs -> Crystal Reports 2008 -> Crystal Reports 2008 I get a windows asking for a valid KeyCode. Then I then opened the License Manager and when I try to add the KeyCode it says:
    License Type
    Selected KeyCode: Production
    All Keycodes: Production
    Report Creating API
    Selected KeyCode: NO
    All Keycodes: NO
    If I click OK it says that the KeyCode is invalid
    Then I installed CR2008 SP1 and I get the same problem. So I installed CR2008 SP FP13 but I'm still having the same problem.
    Is this normal for the upgrade version? if not, does anyone have any idea on how can I get this working?
    Thanks

    Hi,
    Please try to check the Crystal Report, install first the Crystal Report and if it running ok and the if the error appears, if not then install the Visual Studio,
    regards,
    Clint

  • KeyCode problem with KeyEvent

    Hi,
    I'm trying to use '+' and '-' keys in a KeyListener, but the keyCode returned aren't those defined by Java :
    VK_PLUS = 521
    '+' keyCode = 107
    VK_MINUS = 45
    '-' keyCode = 109
    I know there are problems with the localization, but it seemed that these standard keys where correctly managed. Can someone give me an explication ?
    Thanks...

    Instead of event.getKeyCode(), try using event.getKeyChar();
    Chris

  • Keytouch scancodes/keycodes problem

    Hi,
    I tried to configure keytouch to use the special keys on my laptop keyboard (hp probook 5310m). I did follow the instructions in the wiki (https://wiki.archlinux.org/index.php/Keytouch) and created a keyboard configuration for the keys mute, volume up and volume down. Keytouch assigns following codes for the keys:
    -Fn+F9: scancode: 160, keycode: Mute
    -Fn+F11: scancode: 174, keycode: Volume up
    -Fn+F12: scancode: 176, keycode: Volume down
    This seems to be correct. Because when I use "/lib/udev/keymap -i input/event0" I get the following output when I press the special keys (values in brackets were added by me):
    scan code: 0xA0 (160)  key code: mute
    scan code: 0xAE (174)  key code: volumedown
    scan code: 0xB0 (176)  key code: volumeup
    When I press one of the special keys, nothing happens. But when I press another special key (Screenlock (Fn+F6), scancode 138) the event for mute is executed (I see the OSD and the sound is muted/unmuted). So I don't know how to get keytouch to recognize the right special key beeing pressed.
    Does anybody have an idea?
    Thanks for any help.

    Still having the problem . Doesn't even work in mplayer anymore.

  • Problem in jsplitpane

    Hi friends,
    I'm creating a swing application.i've done a split on a jframe using jsplitpane.i'm doing the vertical split at the first time. In the top component i'm having the application name and in the bottom component i've some links to bring up the next screen.Once the user click on the link i'm trying to split the bottom component into another two parts and i'm trying to populate the information.
    i'm using the same frame to get the next screen.here the problem is i'm not able to split the bottom component.
    how to get the bottom component alone and do the split of the bottom component into two parts?
    Edited by: sivabalan on Apr 17, 2008 4:46 AM
    Edited by: sivabalan on Apr 17, 2008 5:05 AM

    Thanks ashwini.
    i'm posting my code here.here the requirement is i need the frame to be split @ run time.kindly execute the below code so that u can get the clear idea abt the requirement.In this first screen i've done a split.so we'll be able to view the title @ the top component and @ the bottom component there'll be link to navigate to the next stage of the application. Exactly here i'm getting the problem. if we clik on this link we can able to see the next stage details. but i need only the bottom component to be split this time. insead of this itz taking the whole frame and spliting into two parts and giving the details. so because of that the application name is getting shrinked.
    The top component of the first screen should always needs to be static. I need only the bottom component to be dynamic.
    import java.awt.Color;
    import java.awt.Container;
    import java.awt.Dimension;
    import java.awt.Font;
    import java.awt.GridBagLayout;
    import java.awt.event.MouseEvent;
    import java.awt.event.MouseListener;
    import java.util.Vector;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    import javax.swing.JScrollPane;
    import javax.swing.JSplitPane;
    public class test extends JPanel //implements KeyListener
         static Vector<String> arrAppName     = new Vector<String>();
         public static JSplitPane splitPane;
         public void AppWin( final JFrame frame)
              Container contentPane = this;
              GridBagLayout gb = new GridBagLayout();
              contentPane.setLayout(gb);
              arrAppName.add("link");
              JLabel lab=new JLabel("<html><font color=#6698FF><a href>"+arrAppName.get(0)+ "</a></font></html>");
              contentPane.add(lab);
              JScrollPane listScrollPane= new JScrollPane(contentPane);
            JLabel label = new JLabel("APPLICATION REPORT",JLabel.CENTER);
            Font font = label.getFont();
            Font font3 = font.deriveFont(25.0f);
            label.setFont(font3);
            label.setFont(label.getFont().deriveFont(Font.ITALIC));
            label.setHorizontalAlignment(JLabel.CENTER);
            label.setForeground(new Color(0x736AFF));
            JScrollPane labelScrollPane = new JScrollPane(label);
            labelScrollPane.setVisible(true);
            contentPane.add(labelScrollPane);
            //Create a split pane with the two scroll panes in it.
            splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
            splitPane.setTopComponent(labelScrollPane);
            splitPane.setBottomComponent(listScrollPane);
            splitPane.setDividerLocation(100);
            Dimension minimumSize = new Dimension(100, 50);
            listScrollPane.setMinimumSize(minimumSize);
            labelScrollPane.setMinimumSize(minimumSize);
              lab.addMouseListener(new MouseListener(){
                   public void mouseClicked(MouseEvent arg0) {
                                  displayMainFrame("link",frame);
                             public void mousePressed(MouseEvent arg0) {
                             public void mouseReleased(MouseEvent arg0) {
                             public void mouseEntered(MouseEvent arg0) {
                             public void mouseExited(MouseEvent arg0) {
         public void buildWindow( String  link,JFrame frame)
              Container contentPane = this;
              GridBagLayout gb = new GridBagLayout();
              contentPane.setLayout(gb);
              JLabel label = new JLabel("Next Screen",JLabel.CENTER);
            Font font = label.getFont();
            Font font3 = font.deriveFont(25.0f);
            label.setFont(font3);
            label.setFont(label.getFont().deriveFont(Font.ITALIC));
            label.setHorizontalAlignment(JLabel.CENTER);
            label.setForeground(new Color(0x736AFF));
            JScrollPane buildWindowtop = new JScrollPane(label);
            buildWindowtop.setVisible(true);
            contentPane.add(buildWindowtop);
            JSplitPane splitPane1 = new JSplitPane();
            splitPane1=splitPane;
    /*(if i try like below line i'm getting error as: "Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: javax.swing.JScrollPane")*/
           //splitPane1=(JSplitPane) splitPane.getBottomComponent();
            splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,splitPane1,buildWindowtop);
            splitPane.setOneTouchExpandable(true);
            splitPane.setDividerLocation(250);
            Dimension minimumSize = new Dimension(100, 50);
            buildWindowtop.setMinimumSize(minimumSize);
            splitPane1.setMinimumSize(minimumSize);
              } // end printing rows
          public static void  displayFrame(String tname, JFrame framedisp,String buttonName,String tranCorrID,String buttonOption,JSplitPane buildSplit)
                     AlignTest mainDispPane = new AlignTest();
                     mainDispPane.buildSpecificWindow(tname,framedisp,buttonName,tranCorrID,buttonOption,buildSplit);
                     framedisp.getContentPane().add(splitPane);
                   framedisp.setVisible(true);
           public static void  displayMainFrame(String link,JFrame framedisp)
                   test mainDispPane = new test();
                   mainDispPane.buildWindow(link,framedisp);
                   framedisp.getContentPane().add(splitPane);
                   framedisp.setVisible(true);
         public static void main(String[] args)
                   JFrame frame = new JFrame("MAIN WINDOW");
                   frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                   test mainPane = new test();
                   mainPane.AppWin(frame);
                   frame.getContentPane().add(splitPane);
                   frame.setSize(1280, 1000);
                   frame.setVisible(true);
              } // end main
    } // end AlignTestEdited by: sivabalan on Apr 17, 2008 11:11 PM

  • Problem of JSplitPane with ScrollPane

    Does JSplitPane work with ScrollPane?i am writing 2 ScrollPanes in a JSplitPane,but i can not move the bound.Thanks!

    It might be a little too late but I will put my 2 cents anyway...
    There is a scenario where mixing ScrollPane and JSplitPane is needed (unless you create your own AWTSplitPane): when you need to contain a heavyweight component (AWT) with a ScrollPane, you cannot use JScrollPane, that's for sure.
    The JSplitPane does not work because the minimumSize of the ScrollPane is set to its size and therefore JSplitPane won't reduce the component under its minimum size. The solution is to extend ScrollPane and override getMinimumSize method to whatever minimum size you decide.

  • Keycode problem tryng to access BO Crystal Reports Explorer

    Hi,
    I´m receiving the message "You do not have the correct keycode installed to use this option"  when trying to access BO XI R2 Crystal Reports Explorer, and I don't know why,  because i have already registered the product and  it´s the only application of the suite not working and asking me "a correct keycode".   Is it possible that it has to do with the evaluation, temporary keycode used during setup? Must I get an unlimited license for BO XI R2 in order this app to work?  Or exists a way to use a separate keycode only for this app?  Please help me
    MAURICIO

    Hi,
    The link you provide points to SAP marketplace logon validation, but because of the fact that I don´t have a marketplace user and password, it is necessary for me to request a password.   Then,  I try to generate one using Option 2 and for that the system asks for "Customer or Installation number" (and suggest that it should be found in System -> Status or Help -> About).
    How can I find Customer or Installation number, in my BusinessObjects Enterprise XI software?
    THANKS !

  • JTree problem (inside JSplitpane)

    Hello All,
    I am trying to place a Jtree inside left side of jsplitpane. But it didn't appear in it and no error or exception thrown. For testing, i placed some other component like a panel inside that left pane of splitpane and it worked fine. For further testing, when I placed my jtree's panel in applet (to test whether it has something wrong with splitpane or some other thing), it didn't appear in it too. Below is the code to illustrate what I do for my last try (in applet):
    public class TRDB extends JApplet {
         public void init() {
              p("init() called");
         public void start() {
              p("start() called");
              //MainWindow mw = new MainWindow();
              //mw.setSize(400,450);
              //mw.setVisible(true);
              TreeViewPane mcp = new TreeViewPane();
              getContentPane().setLayout(null);
              getContentPane().add(mcp);
              mcp.setBounds(0,0,100,300);
              mcp.setBackground(Color.blue);
              p("start() finish!!!!!");
         private void p(String str) {
              System.out.println(str);
    // TreeViewPane class
    public class TreeViewPane extends JPanel {
         JTree tree;
         DefaultMutableTreeNode top;
         public TreeViewPane() {
              top = new DefaultMutableTreeNode("GDAMS");
             createNodes(top);
             tree = new JTree(top);
              tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
             //setOpaque(true);      //content panes must be opaque
         private void createNodes(DefaultMutableTreeNode top) {
             DefaultMutableTreeNode category = null;
             DefaultMutableTreeNode book = null;
             category = new DefaultMutableTreeNode("Books for Java Programmers");
             top.add(category);
             //...add more books for programmers...
             category = new DefaultMutableTreeNode("Books for Java Implementers");
             top.add(category);
    }Please have a look at see if something is wrong. I just saw a blue rectangular box (depicting my jtree panel) on applet without any table in it.
    Plz HELP!!

    I must take some coffee or strong cup of tea. i m exhaust, really. Yah i got it what i did wrong. sorry !!

  • A problem about JSplitPane

    I used a SplitPane to seperate a left tree and a right pane. And I draw geometry on the right pane.
    But when I drag the splitpane seperator, the graph on the right pane displays wrong position.
    How to resolve the problem? Can I add actionlister to the splitpane?

    the right pane displays wrong position
    what does it mean

  • JSplitPane probs

    Hiya,
    I have 2 problems with JSplitPane, here is a screenshot to help explain them:
    http://users.pandora.be/lunatic/javaprobs/splitpaneprob.JPG
    1) (top right red circle) I add a panel to a panel which is in the splitPane after it is created and shown. The added panel makes the minimum size of that side bigger. Only when I touch the devider it makes sure it is like that.
    Called validate on the added panel or the splitPane didn't work.
    2) (bottem red circle) I just want to see nothing there, but let that space still act like a devider, so it is like in most applications.

    Taking the buttons off the panes that you put in the splitter and place them on their own pane under the split pane would solve the problem of the unwanted splitter down between the buttons. Perhaps add the splitter pane to the CENTER of a border layout and the buttons in the SOUTH position.
    Your first problem is more puzzling. Have you tried to create a small sample that illustrates how to get that effect? Sometimes doing that reveals what the problem is other wise you can post it here and we can look at the actual code.
    Ian

  • MouseEvents not catching in JSplitpane

    Hi
    I had problem with JSplitpane, I used in my application for differentiation for two wave graphs, if i drag the splitpane (up/down)then my top and bottom graphs are updated accordingly, i want to write mouse listener and when moveRelesed update the two graphs.
    If i use property change listener for Splitpane it will work ok but the repainting is very slow(because every time), So i want to replace with mouse listener, but pressed on divider and dragged on it the event is not catching.
    please help

    You will ahve to add a mouse listener on the divider but not on the splitpane itself.
    The problem is the divider is implemented by the UI, so you will have to get it from the UI to add the mouse listener to it.
    Here is the principle :
              final JSplitPane sp = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT ,leftPanel, rightPanel);
              (((BasicSplitPaneUI)sp.getUI()).getDivider()).addMouseListener(new MouseAdapter() {
                   public void mouseReleased(MouseEvent e) {
                        System.out.println("Mouse released");
                        sp.getRightComponent().repaint();
                        sp.getLeftComponent().repaint();
              });(nb: I declare sp final to use it in the inner class)
    I hope this will help you,
    Denis

Maybe you are looking for