Changeset 103

Show
Ignore:
Timestamp:
23/06/08 14:44:24 (4 months ago)
Author:
altglass
Message:

Bugfix: SubBitmap? dimension checking in editing dialog
Layout: Window editing dialog got new layout, Pressing return/enter in resources & window editing dialogs triggers the OK button
Main Interface: Cross platform native feel improvement - espc. for Mac OS X

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/vlcskineditor/Main.java

    r102 r103  
    125125    mbar = new JMenuBar(); 
    126126     
     127    //For cross-platform feel (CTRL on Win & Linux, APPLE/COMMAND on Mac OS) 
     128    int mask = java.awt.Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(); 
     129     
    127130    m_file = new JMenu("File"); 
    128131    m_file.setMnemonic("F".charAt(0)); 
     
    130133    m_file_new.setIcon(new_icon); 
    131134    m_file_new.setMnemonic("N".charAt(0)); 
    132     m_file_new.setAccelerator(KeyStroke.getKeyStroke("ctrl N")); 
     135    m_file_new.setAccelerator(KeyStroke.getKeyStroke('N',mask)); 
    133136    m_file_new.addActionListener(this); 
    134137    m_file_open = new JMenuItem("Open"); 
    135138    m_file_open.setIcon(open_icon); 
    136139    m_file_open.setMnemonic('O'); 
    137     m_file_open.setAccelerator(KeyStroke.getKeyStroke("ctrl O")); 
     140    m_file_open.setAccelerator(KeyStroke.getKeyStroke('O',mask)); 
    138141    m_file_open.addActionListener(this);     
    139142    m_file_save = new JMenuItem("Save"); 
    140143    m_file_save.setIcon(save_icon); 
    141144    m_file_save.setMnemonic('S'); 
    142     m_file_save.setAccelerator(KeyStroke.getKeyStroke("ctrl S"));    
     145    m_file_save.setAccelerator(KeyStroke.getKeyStroke('S',mask));    
    143146    m_file_save.addActionListener(this); 
    144147    m_file_test = new JMenuItem("Test skin in VLC..."); 
    145148    m_file_test.setMnemonic('T'); 
    146     m_file_test.setAccelerator(KeyStroke.getKeyStroke("ctrl shift t")); 
     149    m_file_test.setAccelerator(KeyStroke.getKeyStroke('T',mask+InputEvent.SHIFT_DOWN_MASK)); 
    147150    m_file_test.addActionListener(this);     
    148151    m_file_vlt = new JMenuItem("Export as VLT..."); 
    149152    m_file_vlt.setMnemonic('V'); 
    150     m_file_vlt.setAccelerator(KeyStroke.getKeyStroke("ctrl shift v"));    
     153    m_file_vlt.setAccelerator(KeyStroke.getKeyStroke('V',mask+InputEvent.SHIFT_DOWN_MASK));    
    151154    m_file_vlt.addActionListener(this); 
    152155    m_file_png = new JMenuItem("Save current preview as image"); 
     
    154157    m_file_png.addActionListener(this); 
    155158    m_file_png.setEnabled(false); 
    156     m_file_quit = new JMenuItem("Quit"); 
    157     m_file_quit.setIcon(exit_icon); 
    158     m_file_quit.setMnemonic('Q'); 
    159     m_file_quit.setAccelerator(KeyStroke.getKeyStroke("ctrl Q")); 
    160     m_file_quit.addActionListener(this); 
     159    if(System.getProperty("os.name").indexOf("Mac")==-1) { 
     160      m_file_quit = new JMenuItem("Exit"); 
     161      m_file_quit.setIcon(exit_icon); 
     162      m_file_quit.setMnemonic('x'); 
     163      m_file_quit.setAccelerator(KeyStroke.getKeyStroke("alt F4")); 
     164      m_file_quit.addActionListener(this); 
     165    } 
    161166     
    162167    m_file.add(m_file_new); 
     
    176181    m_edit_undo.setIcon(edit_undo_icon); 
    177182    m_edit_undo.setMnemonic('U'); 
    178     m_edit_undo.setAccelerator(KeyStroke.getKeyStroke("ctrl Z")); 
     183    m_edit_undo.setAccelerator(KeyStroke.getKeyStroke('Z',mask)); 
    179184    m_edit_undo.addActionListener(this); 
    180185    m_edit_redo = new JMenuItem("Redo"); 
    181186    m_edit_redo.setIcon(edit_redo_icon); 
    182187    m_edit_redo.setMnemonic('R');     
    183     m_edit_redo.setAccelerator(KeyStroke.getKeyStroke("ctrl Y")); 
     188    m_edit_redo.setAccelerator(KeyStroke.getKeyStroke('Y',mask)); 
    184189    m_edit_redo.addActionListener(this); 
    185190    m_edit_theme = new JMenuItem("Theme settings"); 
    186191    m_edit_theme.setIcon(edit_icon); 
    187192    m_edit_theme.setMnemonic('I'); 
    188     m_edit_theme.setAccelerator(KeyStroke.getKeyStroke("ctrl I")); 
     193    m_edit_theme.setAccelerator(KeyStroke.getKeyStroke('I',mask)); 
    189194    m_edit_theme.addActionListener(this); 
    190195    m_edit_global = new JMenuItem("Global variables"); 
    191196    m_edit_global.setMnemonic('G'); 
    192     m_edit_global.setAccelerator(KeyStroke.getKeyStroke("ctrl G")); 
     197    m_edit_global.setAccelerator(KeyStroke.getKeyStroke('G',mask)); 
    193198    m_edit_global.addActionListener(this); 
    194199    m_edit_up = new JMenuItem("Move selected item up"); 
    195     m_edit_up.setAccelerator(KeyStroke.getKeyStroke("ctrl UP")); 
     200    m_edit_up.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_UP,mask)); 
    196201    m_edit_up.addActionListener(this); 
    197202    m_edit_down = new JMenuItem("Move selected item down"); 
    198     m_edit_down.setAccelerator(KeyStroke.getKeyStroke("ctrl DOWN"));     
     203    m_edit_down.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_DOWN,mask));     
    199204    m_edit_down.addActionListener(this); 
    200205    m_edit_left = new JMenuItem("Move selected item left"); 
    201     m_edit_left.setAccelerator(KeyStroke.getKeyStroke("ctrl LEFT")); 
     206    m_edit_left.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT,mask)); 
    202207    m_edit_left.addActionListener(this); 
    203208    m_edit_right = new JMenuItem("Move selected item right"); 
    204     m_edit_right.setAccelerator(KeyStroke.getKeyStroke("ctrl RIGHT")); 
     209    m_edit_right.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT,mask)); 
    205210    m_edit_right.addActionListener(this); 
    206211     
     
    564569      } 
    565570      catch (Exception e) { 
     571        System.err.println("Could not read VLC installation directory from Registry. VLC might not be properly installed."); 
    566572        e.printStackTrace(); 
    567573      }   
     
    610616    opening = true; 
    611617    String[] exts = { "xml","vlt" }; 
    612     base_fc.setFileFilter(new CustomFileFilter(base_fc,exts,"*.xml (VLC XML-Skin Files), *.vlt (Packed XML-Skins)",false,vlc_dir));       
    613     int returnVal = base_fc.showOpenDialog(this); 
    614     if(returnVal == JFileChooser.APPROVE_OPTION) {       
    615       openFile(base_fc.getSelectedFile()); 
    616       opening = false; 
     618    if(System.getProperty("os.name").indexOf("Mac")==-1) { 
     619      base_fc.setFileFilter(new CustomFileFilter(base_fc,exts,"*.xml (VLC XML-Skin Files), *.vlt (Packed XML-Skins)",false,vlc_dir));       
     620      int returnVal = base_fc.showOpenDialog(this); 
     621      if(returnVal == JFileChooser.APPROVE_OPTION) {       
     622        openFile(base_fc.getSelectedFile()); 
     623        opening = false; 
     624      } 
     625      else { 
     626        opening = false; 
     627        if(!opened) showWelcomeDialog(); 
     628      } 
    617629    } 
    618630    else { 
    619       opening = false; 
    620       if(!opened) showWelcomeDialog(); 
     631      FileDialog fd = new FileDialog(this); 
     632      fd.setMode(FileDialog.LOAD); 
     633      fd.setFilenameFilter(new FilenameFilter() { 
     634        public boolean accept(File f, String s) {  
     635          return f.getName().toUpperCase().matches("*.XML");  
     636        } 
     637      }); 
     638      fd.setVisible(true); 
     639      String f = fd.getFile(); 
     640      if(f!=null) { 
     641        openFile(new File(fd.getDirectory(),fd.getFile())); 
     642        opening = false; 
     643      } 
     644      else { 
     645        opening = false; 
     646        if(!opened) showWelcomeDialog(); 
     647      } 
     648       
    621649    } 
    622650  } 
     
    14991527      pvwin.selectItem(s.getItem(selected_item)); 
    15001528    } 
    1501   } 
    1502   public void windowActivated(WindowEvent e) {} 
    1503   public void windowClosed(WindowEvent e) {} 
     1529  }   
    15041530  public void windowClosing(WindowEvent e) { 
    15051531    if(!saved) { 
     
    15301556    } 
    15311557  } 
    1532   public void windowDeactivated(WindowEvent e) {} 
    1533   public void windowDeiconified(WindowEvent e) {} 
    1534   public void windowIconified(WindowEvent e) {} 
     1558  public void windowClosed(WindowEvent e) {} 
     1559  public void windowActivated(WindowEvent e) { 
     1560    if(pvwin.fu==null) { 
     1561      pvwin.fu = new FrameUpdater(pvwin,5); 
     1562      pvwin.fu.start();       
     1563    } 
     1564  } 
     1565  public void windowDeactivated(WindowEvent e) { 
     1566    pvwin.fu = null; 
     1567  } 
     1568  public void windowDeiconified(WindowEvent e) { 
     1569    if(pvwin.fu==null) { 
     1570      pvwin.fu = new FrameUpdater(pvwin,5); 
     1571      pvwin.fu.start();       
     1572    } 
     1573  } 
     1574  public void windowIconified(WindowEvent e) { 
     1575    pvwin.fu = null; 
     1576  } 
    15351577  public void windowOpened(WindowEvent e) {}   
    15361578  public void mouseClicked(MouseEvent e) { 
     
    15981640        return null; 
    15991641      } 
    1600   } 
     1642  }   
    16011643  /** 
    16021644   * Creates a new instance of Main and thus launches the editor 
     
    16111653    } 
    16121654    JFrame.setDefaultLookAndFeelDecorated(true); 
     1655    System.setProperty("apple.laf.useScreenMenuBar", "true"); 
     1656    System.setProperty("com.apple.mrj.application.apple.menu.about.name", "VLC Skin Editor"); 
    16131657    new Main(args);       
    16141658  } 
  • trunk/src/vlcskineditor/Window.java

    r101 r103  
    153153      playondrop_tf.setToolTipText("Indicates whether a dropped file is played directly (true) or only enqueued (false). This attribute has no effect if dragdrop is set to \"false\"."); 
    154154      ok_btn = new JButton("OK"); 
    155       ok_btn.addActionListener(this); 
    156       ok_btn.setPreferredSize(new Dimension(70,25)); 
     155      ok_btn.addActionListener(this);       
    157156      cancel_btn = new JButton("Cancel"); 
    158       cancel_btn.addActionListener(this); 
    159       cancel_btn.setPreferredSize(new Dimension(70,25)); 
     157      cancel_btn.addActionListener(this);       
    160158      help_btn = new JButton("Help"); 
    161       help_btn.addActionListener(this); 
    162       help_btn.setPreferredSize(new Dimension(70,25)); 
     159      help_btn.addActionListener(this);       
     160      JLabel attr_l = new JLabel("* Attributes marked with a star must be specified."); 
     161       
     162      //Distance of textfields to WEST edge of container 
     163      Component[] labels = { id_l, x_l, y_l, visible_l, dragdrop_l, playondrop_l}; 
     164      int tf_dx = Helper.maxWidth(labels)+10; 
     165      //Max. textfield width 
     166      int tf_wd = 200; 
    163167       
    164168      JPanel general = new JPanel(null); 
    165169      general.add(id_l); 
    166170      general.add(id_tf); 
    167       id_l.setBounds(5,15,75,24); 
    168       id_tf.setBounds(85,15,150,24); 
     171      id_tf.setPreferredSize(new Dimension(tf_wd,id_tf.getPreferredSize().height)); 
    169172      general.add(x_l); 
    170173      general.add(x_tf); 
    171       x_l.setBounds(5,45,75,24); 
    172       x_tf.setBounds(85,45,150,24); 
     174      x_tf.setPreferredSize(new Dimension(tf_wd,x_tf.getPreferredSize().height)); 
    173175      general.add(y_l); 
    174176      general.add(y_tf); 
    175       y_l.setBounds(5,75,75,24); 
    176       y_tf.setBounds(85,75,150,24); 
     177      y_tf.setPreferredSize(new Dimension(tf_wd,y_tf.getPreferredSize().height)); 
    177178      general.add(visible_l); 
    178179      general.add(visible_tf); 
    179       visible_l.setBounds(5,105,75,24); 
    180       visible_tf.setBounds(85,105,75,24); 
     180      visible_tf.setPreferredSize(new Dimension(tf_wd,visible_tf.getPreferredSize().height)); 
    181181      general.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED), "General Attributes")); 
    182       general.setMinimumSize(new Dimension(240,140)); 
    183       general.setPreferredSize(new Dimension(240,140)); 
    184       general.setMaximumSize(new Dimension(240,140)); 
     182      SpringLayout general_layout = new SpringLayout(); 
     183      general.setLayout(general_layout); 
     184      general_layout.putConstraint(SpringLayout.NORTH, id_l, 5, SpringLayout.NORTH, general); 
     185      general_layout.putConstraint(SpringLayout.WEST, id_l, 5, SpringLayout.WEST, general);   
     186       
     187      general_layout.putConstraint(SpringLayout.WEST, id_tf, tf_dx, SpringLayout.WEST, general); 
     188      general_layout.putConstraint(SpringLayout.NORTH, id_tf, 0, SpringLayout.NORTH, id_l);       
     189      general_layout.putConstraint(SpringLayout.EAST, general, 5, SpringLayout.EAST, id_tf);  
     190       
     191      general_layout.putConstraint(SpringLayout.NORTH, x_l, 10, SpringLayout.SOUTH, id_l); 
     192      general_layout.putConstraint(SpringLayout.WEST, x_l, 5, SpringLayout.WEST, general); 
     193       
     194      general_layout.putConstraint(SpringLayout.WEST, x_tf, tf_dx, SpringLayout.WEST, general); 
     195      general_layout.putConstraint(SpringLayout.NORTH, x_tf, 0, SpringLayout.NORTH, x_l); 
     196      general_layout.putConstraint(SpringLayout.EAST, x_tf, 0, SpringLayout.EAST, id_tf); 
     197       
     198      general_layout.putConstraint(SpringLayout.NORTH, y_l, 10, SpringLayout.SOUTH, x_l); 
     199      general_layout.putConstraint(SpringLayout.WEST, y_l, 5, SpringLayout.WEST, general); 
     200       
     201      general_layout.putConstraint(SpringLayout.WEST, y_tf, tf_dx, SpringLayout.WEST, general); 
     202      general_layout.putConstraint(SpringLayout.NORTH, y_tf, 0, SpringLayout.NORTH, y_l); 
     203      general_layout.putConstraint(SpringLayout.EAST, y_tf, 0, SpringLayout.EAST, id_tf); 
     204       
     205      general_layout.putConstraint(SpringLayout.NORTH, visible_l, 10, SpringLayout.SOUTH, y_l); 
     206      general_layout.putConstraint(SpringLayout.WEST, visible_l, 5, SpringLayout.WEST, general); 
     207       
     208      general_layout.putConstraint(SpringLayout.WEST, visible_tf, tf_dx, SpringLayout.WEST, general); 
     209      general_layout.putConstraint(SpringLayout.NORTH, visible_tf, 0, SpringLayout.NORTH, visible_l); 
     210      general_layout.putConstraint(SpringLayout.EAST, visible_tf, 0, SpringLayout.EAST, id_tf); 
     211       
     212      general_layout.putConstraint(SpringLayout.SOUTH, general, 10, SpringLayout.SOUTH, visible_l);       
    185213      frame.add(general); 
    186214       
     
    188216      options.add(dragdrop_l); 
    189217      options.add(dragdrop_tf); 
    190       dragdrop_l.setBounds(5,15,75,24); 
    191       dragdrop_tf.setBounds(85,15,150,24); 
     218      dragdrop_tf.setPreferredSize(new Dimension(tf_wd,dragdrop_tf.getPreferredSize().height)); 
    192219      options.add(playondrop_l); 
    193220      options.add(playondrop_tf); 
    194       playondrop_l.setBounds(5,45,75,24); 
    195       playondrop_tf.setBounds(85,45,150,24); 
     221      playondrop_tf.setPreferredSize(new Dimension(tf_wd,playondrop_tf.getPreferredSize().height)); 
    196222      options.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED), "Drag and drop options")); 
    197       options.setMinimumSize(new Dimension(240,85)); 
    198       options.setPreferredSize(new Dimension(240,85)); 
    199       options.setMaximumSize(new Dimension(240,85)); 
     223      SpringLayout options_layout = new SpringLayout(); 
     224      options.setLayout(options_layout); 
     225      options_layout.putConstraint(SpringLayout.NORTH, dragdrop_l, 5, SpringLayout.NORTH, options); 
     226      options_layout.putConstraint(SpringLayout.WEST, dragdrop_l, 5, SpringLayout.WEST, options); 
     227       
     228      options_layout.putConstraint(SpringLayout.WEST, dragdrop_tf, tf_dx, SpringLayout.WEST, options); 
     229      options_layout.putConstraint(SpringLayout.NORTH, dragdrop_tf, 0, SpringLayout.NORTH, dragdrop_l); 
     230      options_layout.putConstraint(SpringLayout.EAST, options, 5, SpringLayout.EAST, dragdrop_tf); 
     231       
     232      options_layout.putConstraint(SpringLayout.NORTH, playondrop_l, 10, SpringLayout.SOUTH, dragdrop_l); 
     233      options_layout.putConstraint(SpringLayout.WEST, playondrop_l, 5, SpringLayout.WEST, options); 
     234       
     235      options_layout.putConstraint(SpringLayout.WEST, playondrop_tf, tf_dx, SpringLayout.NORTH, options); 
     236      options_layout.putConstraint(SpringLayout.NORTH, playondrop_tf, 0, SpringLayout.NORTH, playondrop_l); 
     237      options_layout.putConstraint(SpringLayout.EAST, playondrop_tf, 0, SpringLayout.EAST, dragdrop_tf); 
     238       
     239      options_layout.putConstraint(SpringLayout.SOUTH, options, 10, SpringLayout.SOUTH, playondrop_l); 
    200240      frame.add(options); 
    201241       
     
    203243      frame.add(cancel_btn); 
    204244      frame.add(help_btn); 
    205       frame.add(new JLabel("* required attribute")); 
    206        
    207       frame.setMinimumSize(new Dimension(250,310)); 
    208       frame.setPreferredSize(new Dimension(250,310)); 
    209       frame.setMaximumSize(new Dimension(250,310)); 
     245      frame.add(attr_l); 
     246       
     247      SpringLayout layout = new SpringLayout(); 
     248      frame.setLayout(layout); 
     249       
     250      layout.putConstraint(SpringLayout.NORTH, general, 5, SpringLayout.NORTH, frame.getContentPane()); 
     251      layout.putConstraint(SpringLayout.WEST, general, 5, SpringLayout.WEST, frame.getContentPane()); 
     252       
     253      layout.putConstraint(SpringLayout.NORTH, options, 5, SpringLayout.SOUTH, general); 
     254      layout.putConstraint(SpringLayout.WEST, options, 5, SpringLayout.WEST, frame.getContentPane()); 
     255       
     256      layout.putConstraint(SpringLayout.NORTH, attr_l, 5, SpringLayout.SOUTH, options); 
     257      layout.putConstraint(SpringLayout.WEST, attr_l, 5, SpringLayout.WEST, frame.getContentPane()); 
     258      layout.putConstraint(SpringLayout.EAST, attr_l, 5, SpringLayout.EAST, frame.getContentPane()); 
     259       
     260       
     261      layout.putConstraint(SpringLayout.NORTH, ok_btn, 5, SpringLayout.SOUTH, attr_l); 
     262      layout.putConstraint(SpringLayout.NORTH, cancel_btn, 5, SpringLayout.SOUTH, attr_l); 
     263      layout.putConstraint(SpringLayout.NORTH, help_btn, 5, SpringLayout.SOUTH, attr_l); 
     264       
     265      layout.putConstraint(SpringLayout.WEST, ok_btn, 5, SpringLayout.WEST, frame.getContentPane()); 
     266      layout.putConstraint(SpringLayout.WEST, cancel_btn, 5, SpringLayout.EAST, ok_btn); 
     267      layout.putConstraint(SpringLayout.WEST, help_btn, 5, SpringLayout.EAST, cancel_btn); 
     268       
     269      layout.putConstraint(SpringLayout.SOUTH, frame.getContentPane(), 5, SpringLayout.SOUTH, ok_btn); 
     270      layout.putConstraint(SpringLayout.EAST, frame.getContentPane(), 5, SpringLayout.EAST, general); 
    210271       
    211272      frame.pack(); 
     273       
     274      frame.getRootPane().setDefaultButton(ok_btn); 
    212275    } 
    213276    id_tf.setText(id); 
  • trunk/src/vlcskineditor/resources/Bitmap.java

    r102 r103  
    353353      frame.pack(); 
    354354       
     355      frame.getRootPane().setDefaultButton(ok_btn); 
    355356    } 
    356357    id_tf.setText(id); 
  • trunk/src/vlcskineditor/resources/Font.java

    r102 r103  
    255255       
    256256      frame.pack(); 
     257       
     258      frame.getRootPane().setDefaultButton(ok_btn); 
    257259    } 
    258260    id_tf.setText(id); 
  • trunk/src/vlcskineditor/resources/SubBitmap.java

    r102 r103  
    221221      bounds.setLayout(bounds_layout); 
    222222      bounds_layout.putConstraint(SpringLayout.NORTH, x_l, 5, SpringLayout.NORTH, bounds); 
    223       bounds_layout.putConstraint(SpringLayout.WEST, x_l, 5, SpringLayout.WEST, bounds);       
     223      bounds_layout.putConstraint(SpringLayout.WEST, x_l, 5, SpringLayout.WEST, bounds); 
     224       
    224225      bounds_layout.putConstraint(SpringLayout.WEST, x_tf, tf_dx, SpringLayout.WEST, bounds); 
    225226      bounds_layout.putConstraint(SpringLayout.NORTH, x_tf, 0, SpringLayout.NORTH, x_l); 
    226       bounds_layout.putConstraint(SpringLayout.EAST, bounds, 5, SpringLayout.EAST, x_tf);       
     227      bounds_layout.putConstraint(SpringLayout.EAST, bounds, 5, SpringLayout.EAST, x_tf); 
     228       
    227229      bounds_layout.putConstraint(SpringLayout.NORTH, y_l, 10, SpringLayout.SOUTH, x_l); 
    228       bounds_layout.putConstraint(SpringLayout.WEST, y_l, 5, SpringLayout.WEST, bounds);       
     230      bounds_layout.putConstraint(SpringLayout.WEST, y_l, 5, SpringLayout.WEST, bounds); 
     231       
    229232      bounds_layout.putConstraint(SpringLayout.WEST, y_tf, tf_dx, SpringLayout.WEST, bounds); 
    230233      bounds_layout.putConstraint(SpringLayout.NORTH, y_tf, 0, SpringLayout.NORTH, y_l); 
    231234      bounds_layout.putConstraint(SpringLayout.EAST, y_tf, 0, SpringLayout.EAST, x_tf); 
     235       
    232236      bounds_layout.putConstraint(SpringLayout.NORTH, width_l, 10, SpringLayout.SOUTH, y_l); 
    233       bounds_layout.putConstraint(SpringLayout.WEST, width_l, 5, SpringLayout.WEST, bounds);       
     237      bounds_layout.putConstraint(SpringLayout.WEST, width_l, 5, SpringLayout.WEST, bounds); 
     238       
    234239      bounds_layout.putConstraint(SpringLayout.WEST, width_tf, tf_dx, SpringLayout.WEST, bounds); 
    235240      bounds_layout.putConstraint(SpringLayout.NORTH, width_tf, 0, SpringLayout.NORTH, width_l); 
    236241      bounds_layout.putConstraint(SpringLayout.EAST, width_tf, 0, SpringLayout.EAST, x_tf); 
     242       
    237243      bounds_layout.putConstraint(SpringLayout.NORTH, height_l, 10, SpringLayout.SOUTH, width_l); 
    238       bounds_layout.putConstraint(SpringLayout.WEST, height_l, 5, SpringLayout.WEST, bounds);       
     244      bounds_layout.putConstraint(SpringLayout.WEST, height_l, 5, SpringLayout.WEST, bounds); 
     245       
    239246      bounds_layout.putConstraint(SpringLayout.WEST, height_tf, tf_dx, SpringLayout.WEST, bounds); 
    240247      bounds_layout.putConstraint(SpringLayout.NORTH, height_tf, 0, SpringLayout.NORTH, height_l); 
    241       bounds_layout.putConstraint(SpringLayout.EAST, height_tf, 0, SpringLayout.EAST, x_tf);       
     248      bounds_layout.putConstraint(SpringLayout.EAST, height_tf, 0, SpringLayout.EAST, x_tf); 
     249       
    242250      bounds_layout.putConstraint(SpringLayout.SOUTH, bounds, 10, SpringLayout.SOUTH, height_l); 
    243251      frame.add(bounds); 
     
    299307       
    300308      frame.pack();       
     309       
     310      frame.getRootPane().setDefaultButton(ok_btn); 
    301311    } 
    302312    id_tf.setText(id);     
     
    335345        return; 
    336346      } 
    337       if(Integer.parseInt(x_tf.getText())+Integer.parseInt(height_tf.getText())>parent.image.getHeight()) { 
     347      if(Integer.parseInt(x_tf.getText())+Integer.parseInt(width_tf.getText())>parent.image.getWidth()) { 
    338348        JOptionPane.showMessageDialog(frame,"Specified dimensions are outside the parent bitmap!","Dimension not valid",JOptionPane.INFORMATION_MESSAGE); 
    339349        return;