TreeSelectionListener with JPanel is not reacting

Hi all!
I have class which extends JPanel, and is later docked in a side menu. The effect should be like the Tools menu in VisualStudio.
Inside the JPanel I have a JTree. And the TreeSelectionListener isn't working. I tried the JTree code in a plain project and it works. So I figure it's something to do with the JPanel.
Here my code with the JTree
package de.lmu.ifi.pst.swep.rid.gui;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.Map;
import java.util.TreeMap;
import javax.swing.*;
import javax.swing.tree.*;
import javax.swing.event.*;
import com.vlsolutions.swing.docking.DockKey;
import com.vlsolutions.swing.docking.Dockable;
import de.lmu.ifi.pst.swep.rid.cartridgeInterface.AbstractCartridgeElement;
import de.lmu.ifi.pst.swep.rid.cartridgeInterface.AbstractModelElement;
import de.lmu.ifi.pst.swep.rid.cartridgeInterface.ICartridge;
import de.lmu.ifi.pst.swep.rid.cartridgeloader.CartridgeLoader;
import de.lmu.ifi.pst.swep.rid.cartridgeloader.ComponentLoader;
import de.lmu.ifi.pst.swep.rid.interfaces.ICartridgeBay;
import de.lmu.ifi.pst.swep.rid.utils.IconProvider;
import de.lmu.ifi.pst.swep.rid.utils.Settings;
import de.lmu.ifi.pst.swep.rid.utils.IconProvider.Identifier;
* The toolbar for selecting canvas tools, such as select and new Cartridge
* Element creation.
public class CartridgeToolbar extends JPanel implements Dockable, ICartridgeBay {
     static {
          Settings.register("cartridge.selection.none", false);
          Settings.register("cartridge.selection.default", true);
          Settings.register("cartridge.selection.user", false);
          Settings.register("cartridge.selection.xul", true);
          Settings.register("cartridge.selection.uml", true);
     private static final long serialVersionUID = 8926943523499013449L;
     private DockKey dockKey = new DockKey("cartridgeToolbar", "Tools", null, IconProvider
               .getSmallImage(Identifier.VIEW_TOOLS));
     private Map<String, ArrayList<AbstractCartridgeElement>> cartridgeGroups = new TreeMap<String, ArrayList<AbstractCartridgeElement>>();
     private JTree cartridgeTree;
     public CartridgeToolbar(ComponentLoader componentLoader) {
          super();
          dockKey.setFloatEnabled(true);
          dockKey.setMaximizeEnabled(false);
          dockKey.setResizeWeight(0.1f);          
          this.setLayout(new BorderLayout());          
          setPreferredSize(new Dimension(200, 600));
          cartridgeTree = new JTree(new DefaultMutableTreeNode("Unpainted tree"));
          DefaultTreeCellRenderer renderer = new DefaultTreeCellRenderer();
             renderer.setOpenIcon(null);
             renderer.setClosedIcon(null);
             renderer.setLeafIcon(null);
             cartridgeTree.setCellRenderer(renderer);
          cartridgeTree.putClientProperty("JTree.lineStyle", "None");
          DefaultTreeSelectionModel selectionModel = new DefaultTreeSelectionModel();
             selectionModel.setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
          cartridgeTree.setSelectionModel(selectionModel);
          fillTreeWith("cartridgexul.xml");
          fillTreeWith("cartridgeuml.xml");
          cartridgeTree.getSelectionModel().addTreeSelectionListener(new TreeSelectionListener() {//FIXME: listener not working
               @Override
               public synchronized void valueChanged(TreeSelectionEvent e) {
                  DefaultMutableTreeNode node = (DefaultMutableTreeNode) e.getPath().getLastPathComponent();
                  System.out.println("You selected " + node);
          cartridgeTree.putClientProperty("JTree.lineStyle", "None");
          cartridgeTree.setSelectionModel(null);
          JScrollPane scrollPane = new JScrollPane(cartridgeTree);
          this.add(scrollPane, BorderLayout.CENTER);
      * Method returns the name of the currently selected Cartridge Element that is to be drawn on the canvas
      * @return
      *           Name of the selected cartridge element.
     public String getSelectedElement()
        //TODO: if inner node
          return cartridgeTree.getLastSelectedPathComponent().toString();          
     private void fillTreeWith(String cartrigdeFileName)
          File dir = new File(".");
          String rootPath;
          try {
               rootPath = dir.getCanonicalPath() + File.separator + "resources";
               addCartridge(rootPath, cartrigdeFileName);
          } catch (IOException e) {
               e.printStackTrace();
     public void addCartridge(String rootPath, String cartrigdeFileName) {
          CartridgeLoader catridgeLoader = new CartridgeLoader(rootPath, cartrigdeFileName);
          ICartridge cartridgeInterface = catridgeLoader.loadCartridge();
          final String nameCartridge = cartridgeInterface.getCartridgeName();
          ArrayList<AbstractCartridgeElement> catridgeGroupElements = generateFactories(cartridgeInterface);
          DefaultMutableTreeNode root = (DefaultMutableTreeNode) cartridgeTree.getModel().getRoot();
          DefaultMutableTreeNode cartridgeGroupNode= new DefaultMutableTreeNode(nameCartridge);
          DefaultMutableTreeNode elementNode ;
          DefaultMutableTreeNode subElementNode;
          for (AbstractCartridgeElement element : catridgeGroupElements) {
               elementNode = new DefaultMutableTreeNode(element.getElementName());//TODO: add icon
               subElementNode = new DefaultMutableTreeNode(element.getElementName() + "1");
               elementNode.add(subElementNode);
               subElementNode = new DefaultMutableTreeNode(element.getElementName() + "2");
               elementNode.add(subElementNode);
                  cartridgeGroupNode.add(elementNode);//TODO: add subType          
          root.add(cartridgeGroupNode);
          cartridgeGroups.put(cartridgeInterface.getCartridgeName(), catridgeGroupElements);
      * With getting a new cartridge interface the method will be able to create
      * all factories of the cartridge interface. Element factories are used to
      * add new elements to the canvas.
      * @return List of factories belonging to a cartridge interface
     private ArrayList<AbstractCartridgeElement> generateFactories(ICartridge cartridgeInterface) {
          ArrayList<AbstractCartridgeElement> cartridgeGroupElements = new ArrayList<AbstractCartridgeElement>();
          for (Enumeration<Integer> el = cartridgeInterface.getElementIDs(); el.hasMoreElements();) {
               cartridgeGroupElements.add(cartridgeInterface.getElementFactoryByID((Integer) el.nextElement()));
          return cartridgeGroupElements;
     @Override
     public DockKey getDockKey() {
          return dockKey;
     @Override
     public AbstractModelElement createCartridgeElement(String id) {
          // getElementFactoryByID
          return null;
     @Override
     public Component getComponent() {
          // TODO Auto-generated method stub
          return null;
     @Override
     public JComponent getComponent(String path, String cartridgeName) {
          // TODO Auto-generated method stub
          return null;
     @Override
     public void setButtonGroup(ButtonGroup buttongroup) {
          // TODO Auto-generated method stub
}The most important is ofcourse the constructor. Any suggestions and help would be greatly apprieciated.
best of all,
Szymon

cartridgeTree.setSelectionModel(null);You creating a new selection model, add it to the tree and add a listener to it. Then you throw it away.

Similar Messages

  • Problems with the screen not reacting to my touch

    Right before my problem happened, I was facetiming with my friend. Then I press the home button to do my password to unlock my ipad 2. However, when I try to do it, my ipad won't react when I touch it or scroll it. I tried reseting my ipad 2, but i have to scroll the button to do that, but that was the problem. I can't move anything on the screen. The buttons work just fine, so I don't think it is broken. Plz help sombody!
    I have an extra problem that isn't related to apple, but i'm just putting it anyways. When I turn on my laptop, it just stops on the black page where the words come out right before the user screen. I tried turning it off, waiting for it, asking the people from the company about it (kinda), but it doesn't work. My dad thinks that the hard drive is broken or something, that was why, he said, that it couldn't get pass to the user screen. If that wasn't it than I hope somebody could explain it. Why did I put this here? I just have a feeling that it's not broken.

    Did you reboot the iPad?
    Reboot the iPad by holding down on the sleep and home buttons at the same time for about 10-15 seconds until the Apple Logo appears - ignore the red slider - let go of the buttons.

  • JTable with ImageIcons does not react to even handling

    Hi.
    I have a populated JTable with ONLY ImageIcons in it. I need to generate event responses on mouseClicks. However, any event listener I associate with this, nothing seems to be happening.
    (Somehow, I'm guess the ImageIcons - which are rendered on a JLabel, are/is the source of all troubles!!)
    The code is below :
    import java.io.File;
    import java.awt.Point;
    import java.awt.Color;
    import java.awt.Dimension;
    import java.awt.Container;
    import java.awt.Component;
    import java.awt.event.MouseAdapter;
    import java.awt.event.MouseEvent;
    import javax.swing.JFrame;
    import javax.swing.JDialog;
    import javax.swing.JLabel;
    import javax.swing.JTable;
    import javax.swing.ImageIcon;
    import javax.swing.JScrollPane;
    import javax.swing.ListSelectionModel;
    import javax.swing.table.TableColumn;
    import javax.swing.table.TableCellRenderer;
    import javax.swing.table.AbstractTableModel;
    import javax.swing.event.ListSelectionEvent;
    import javax.swing.event.ListSelectionListener;
    *     Entry point for the Images Table.
    *     @author Raj Gaurav
    public class SpecialCharacterDialog extends JDialog{
         String collectionString[] = null;
         ImageIcon suite[] = null;
         public SpecialCharacterDialog() {
              Container contentPane = getContentPane();
              //     Create the Table Model and create the Table from the model
              MyTableModel model = new MyTableModel();
              JTable table = new JTable(model);
              table.setDefaultRenderer(ImageIcon.class, new CustomCellRenderer());
              table.setCellSelectionEnabled(true);
              table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    ListSelectionModel rowSM = table.getSelectionModel();
    rowSM.addListSelectionListener(new ListSelectionListener() {
    public void valueChanged(ListSelectionEvent e) {
    //Ignore extra messages.
    if (e.getValueIsAdjusting()) return;
    ListSelectionModel lsm = (ListSelectionModel)e.getSource();
    if (lsm.isSelectionEmpty()) {
    System.out.println("No rows are selected.");
    } else {
    int selectedRow = lsm.getMinSelectionIndex();
    System.out.println("Row " + selectedRow
    + " is now selected.");
              //     Add the table to the contentPane
              JScrollPane pane = new JScrollPane(table);
              contentPane.add(pane);
    *     This class contains all the DATA information, the ImageIcons
    *     needed for display.
    class SymbolCollection {
         final static int NUMBER_OF_COLUMNS = 15;
         private String collectionString[] = null;
         private ImageIcon suite[] = null;
         *     Constructor : Initialises all the ImageIcon and their Names.
         public SymbolCollection() {
              File f = new File("C:\\Test\\Images");
              collectionString = f.list();
              int numberOfImages = collectionString.length;
              suite = new ImageIcon[numberOfImages];
              for(int i = 0;i < numberOfImages; i++) {
                   suite[i] = new ImageIcon("C:\\Test\\images" + File.separator + collectionString);
         *     Returns the total number of images in "images" folder.
         public int getTotalNumberOfImages() {
              return suite.length;
         *     Returns the target ImageIcon.
         public ImageIcon getImageIconAt(int number) {
              return suite[number];
         *     Returns the target ImageIcon Name.
         public String getImageIconNameAt(int number) {
              return collectionString[number];
         *     Returns an array of ALL the ImageIcons available.
         public ImageIcon[] getImageIcons() {
              return suite;
         *     Returns an array of ALL the ImageIcon names available
         public String[] getImageIconNames() {
              return collectionString;
         *     Returns TRUE for all cells
         public boolean isEditable(int row, int col) {
              return true;
    *     Defines the table model for the tabel.
    class MyTableModel extends AbstractTableModel {
         private SymbolCollection collection = null;
         private Object data[][] = null;
         *     Constructor for the TableModel. Initialises the "data" field for table.
         public MyTableModel() {
              int countOfImages = 0;
              collection = new SymbolCollection();
              data = new Object[getRowCount()][SymbolCollection.NUMBER_OF_COLUMNS];
              for(int i = 0; i < getRowCount(); i++) {
                   for(int j = 0; j < SymbolCollection.NUMBER_OF_COLUMNS; j++) {
                        if(countOfImages == collection.getTotalNumberOfImages()) {
                             break;
                        data[i][j] = collection.getImageIconAt(countOfImages);
                        countOfImages++;
         *     Returns the number of rows for this table.
         *     It is calculated as : TotalNumber/NumberOfColumns if remainder is ZERO or,
         *                              TotalNumber/NumberOfColumns + 1 if not.
         public int getRowCount() {
              int numberOfRows = collection.getTotalNumberOfImages()/SymbolCollection.NUMBER_OF_COLUMNS;
              if(numberOfRows == 0) {
                   return numberOfRows;
              else {
                   return numberOfRows + 1;
         *     Returns the number of Columns for this table
         public int getColumnCount() {
              return SymbolCollection.NUMBER_OF_COLUMNS;
         *     Returns the CLASS data type for this table
         public Class getColumnClass(int col) {
              return collection.getImageIconAt(0).getClass();
         *     Returns the table data at (row, col).
         public Object getValueAt(int row, int col) {
              return data[row][col];
    *     Renders the table to display images in individual cells
    class CustomCellRenderer extends JLabel implements TableCellRenderer {
         public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int col) {
              setIcon((ImageIcon)value);
              return this;

    Hi.
    I have a populated JTable with ONLY ImageIcons in it. I need to generate event responses on mouseClicks. However, any event listener I associate with this, nothing seems to be happening.
    (Somehow, I'm guess the ImageIcons - which are rendered on a JLabel, are/is the source of all troubles!!)
    The code is below :
    import java.io.File;
    import java.awt.Point;
    import java.awt.Color;
    import java.awt.Dimension;
    import java.awt.Container;
    import java.awt.Component;
    import java.awt.event.MouseAdapter;
    import java.awt.event.MouseEvent;
    import javax.swing.JFrame;
    import javax.swing.JDialog;
    import javax.swing.JLabel;
    import javax.swing.JTable;
    import javax.swing.ImageIcon;
    import javax.swing.JScrollPane;
    import javax.swing.ListSelectionModel;
    import javax.swing.table.TableColumn;
    import javax.swing.table.TableCellRenderer;
    import javax.swing.table.AbstractTableModel;
    import javax.swing.event.ListSelectionEvent;
    import javax.swing.event.ListSelectionListener;
    *     Entry point for the Images Table.
    *     @author Raj Gaurav
    public class SpecialCharacterDialog extends JDialog{
         String collectionString[] = null;
         ImageIcon suite[] = null;
         public SpecialCharacterDialog() {
              Container contentPane = getContentPane();
              //     Create the Table Model and create the Table from the model
              MyTableModel model = new MyTableModel();
              JTable table = new JTable(model);
              table.setDefaultRenderer(ImageIcon.class, new CustomCellRenderer());
              table.setCellSelectionEnabled(true);
              table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    ListSelectionModel rowSM = table.getSelectionModel();
    rowSM.addListSelectionListener(new ListSelectionListener() {
    public void valueChanged(ListSelectionEvent e) {
    //Ignore extra messages.
    if (e.getValueIsAdjusting()) return;
    ListSelectionModel lsm = (ListSelectionModel)e.getSource();
    if (lsm.isSelectionEmpty()) {
    System.out.println("No rows are selected.");
    } else {
    int selectedRow = lsm.getMinSelectionIndex();
    System.out.println("Row " + selectedRow
    + " is now selected.");
              //     Add the table to the contentPane
              JScrollPane pane = new JScrollPane(table);
              contentPane.add(pane);
    *     This class contains all the DATA information, the ImageIcons
    *     needed for display.
    class SymbolCollection {
         final static int NUMBER_OF_COLUMNS = 15;
         private String collectionString[] = null;
         private ImageIcon suite[] = null;
         *     Constructor : Initialises all the ImageIcon and their Names.
         public SymbolCollection() {
              File f = new File("C:\\Test\\Images");
              collectionString = f.list();
              int numberOfImages = collectionString.length;
              suite = new ImageIcon[numberOfImages];
              for(int i = 0;i < numberOfImages; i++) {
                   suite[i] = new ImageIcon("C:\\Test\\images" + File.separator + collectionString);
         *     Returns the total number of images in "images" folder.
         public int getTotalNumberOfImages() {
              return suite.length;
         *     Returns the target ImageIcon.
         public ImageIcon getImageIconAt(int number) {
              return suite[number];
         *     Returns the target ImageIcon Name.
         public String getImageIconNameAt(int number) {
              return collectionString[number];
         *     Returns an array of ALL the ImageIcons available.
         public ImageIcon[] getImageIcons() {
              return suite;
         *     Returns an array of ALL the ImageIcon names available
         public String[] getImageIconNames() {
              return collectionString;
         *     Returns TRUE for all cells
         public boolean isEditable(int row, int col) {
              return true;
    *     Defines the table model for the tabel.
    class MyTableModel extends AbstractTableModel {
         private SymbolCollection collection = null;
         private Object data[][] = null;
         *     Constructor for the TableModel. Initialises the "data" field for table.
         public MyTableModel() {
              int countOfImages = 0;
              collection = new SymbolCollection();
              data = new Object[getRowCount()][SymbolCollection.NUMBER_OF_COLUMNS];
              for(int i = 0; i < getRowCount(); i++) {
                   for(int j = 0; j < SymbolCollection.NUMBER_OF_COLUMNS; j++) {
                        if(countOfImages == collection.getTotalNumberOfImages()) {
                             break;
                        data[i][j] = collection.getImageIconAt(countOfImages);
                        countOfImages++;
         *     Returns the number of rows for this table.
         *     It is calculated as : TotalNumber/NumberOfColumns if remainder is ZERO or,
         *                              TotalNumber/NumberOfColumns + 1 if not.
         public int getRowCount() {
              int numberOfRows = collection.getTotalNumberOfImages()/SymbolCollection.NUMBER_OF_COLUMNS;
              if(numberOfRows == 0) {
                   return numberOfRows;
              else {
                   return numberOfRows + 1;
         *     Returns the number of Columns for this table
         public int getColumnCount() {
              return SymbolCollection.NUMBER_OF_COLUMNS;
         *     Returns the CLASS data type for this table
         public Class getColumnClass(int col) {
              return collection.getImageIconAt(0).getClass();
         *     Returns the table data at (row, col).
         public Object getValueAt(int row, int col) {
              return data[row][col];
    *     Renders the table to display images in individual cells
    class CustomCellRenderer extends JLabel implements TableCellRenderer {
         public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int col) {
              setIcon((ImageIcon)value);
              return this;

  • On my MacBook with Lion Safari does start, does not react immediately after trying to open it. Installing a new Safari does not help. Removing parts of Safari in the Library did not help. Where can I find and remove all components (LastSession ...)?

    How can I reset Safari with all components? On my MacBook with Lion, Safari does not start, does not react immediately after trying to open it. Installing a new Safari does not help. Removing parts of Safari in the Library does not help. Where can I find and remove all components as LastSession and TopSites?

    The only way to reinstall Safari on a Mac running v10.7 Lion is to restore OS X using OS X Recovery
    Instead of restoring OS X in order to reinstall Safari, try troubleshooting extensions.
    From the Safari menu bar click Safari > Preferences then select the Extensions tab. Turn that OFF, quit and relaunch Safari to test.
    If that helped, turn one extension on then quit and relaunch Safari to test until you find the incompatible extension then click uninstall.
    If it's not an extensions issue, try troubleshooting third party plug-ins.
    Back to Safari > Preferences. This time select the Security tab. Deselect:  Allow plug-ins. Quit and relaunch Safari to test.
    If that made a difference, instructions for troubleshooting plugins here.
    If it's not an extension or plug-in issue, delete the cache.
    Open a Finder window. From the Finder menu bar click Go > Go to Folder
    Type or copy paste the following
    ~/Library/Caches/com.apple.Safari/Cache.db
    Click Go then move the Cache.db file to the Trash.
    Quit and relaunch Safari to test.

  • I have updated my Iphone5 with new IOS6 - now the screen/display does not react to my taps on screen as in i cant tap in my pin to start???

    I have updated my Iphone5 with new IOS6 - now the screen/display does not react to my taps on screen as in i cant tap in my pin to startup???

    I have updated my Iphone5 with new IOS6 - now the screen/display does not react to my taps on screen as in i cant tap in my pin to startup???

  • Thunderbolt screen not reacting with Yosemite

    I updated this week to Yosemite on my MacBook Pro 2012, connected to a Thunderbolt screen.
    All working fine, but as soon as my MacBook goes in sleeping mode, the thunderbolt screen will not react anymore.
    MacBook awakes, starts up again, thunderbolt screen stays black.
    Only thing that helps is turning electricity off of the screen, put it on again and everything comes to life again.
    Didn't have this problem with Mountain Lion or Mavericks.

    Im also having an issue with my monitor since I updated to Yosemite.  I have a mid 2010 15" mac book pro.
    Everything seems to be working fine until i plug in my old apple monitor thru a mini video adaptor.  Then
    my computer slows and freezes, its unusable.  I spent a few hours at the genious bar with my mac book pro
    yesterday, tested fine, working fine without the monitor plugged in.  Never had an issue with Mavericks or any
    other OS.

  • My i-pad is not reacting anymore?

    my i-pad touch screen is not reacting- tried allready : synchronize with i-tunes, loading?

    Try a reset:
    1. Hold the Sleep and Home button down (together) for about 10 seconds
    2. Until you see the Apple logo (very important)

  • Aperture export is not working, "Choose" buttons also  not reacting

    Suddenly I can't export versions, originals, metadata and export as library anymore. Also all "Choose" buttons do not react anymore. For example its not possible to open another Library or choose the external photo editor in Preferences. If I login with my second useraccount Aperture does work just fine.
    On Monday I had no problems at all. Sofar I did the following things:
    FIRST.
    Repair Diskpermissions and Verify disk which was OK.
    Moved to desktop following files:
    ~/Library/Preferences/com.apple.Aperture
    ~/Library/Caches/com.apple.Apertue
    ~/Library/Containers/com.apple.Aperture
    Emptied the trash and restarted. The problem is not solved.
    SECOND.
    All the above actions and restart.
    Aperture Photolibrary first aid, "Repair Permissins" , "Repair Database" and "Rebuild Database".
    The problem is not solved.
    THIRD.
    Uninstalled Aperture and removed all files containing the frase "Aperture" (as far as these files had any connection with the application).
    Repair Diskpermissions and Verify disk which was OK.
    Emptied the trash and restarted.
    Installed Aperture from DVD and update via Apstore.
    Still the same problems so I am asking the form members for help.
    Mathieu

    Are you having any troubles wiht other applications run from  this account?
    From what you wrote you seemed to have covered all the bases not sure what else to suggest. What is the system?
    Do you have any plugins installed in Aperture ?  What about any applications, plugins etc, for this account?
    You can try doing a safe boot (hold the shift key down as soon as you hear the start up chime. Hod it until the Apple appears on the screen) Safe boot takes longer to come up, there will be a status bar at the bottom of the screen while it boots. Once it is up you will see Safe Boot in red letters at the top of the screen on the login page. This might not work if you have File Vault turned on.
    Once booted in Safe mode log in. Aperture use to not run in Safe mode because the graphics card is restricted but I believe in 3.5. it will run. Note everything will be slow and jerky.
    See if that makes a difference. Once done testing boot normally and try it again.

  • A bug with JPanel?

    I got a very ackward problem with JPanel. Please check the code below:
    import javax.swing.JPanel;
    public BasePanel extends JPanel{
        public BasePanel(){
           super();
    public class bb extends javax.swing.JDialog {
        public bb(java.awt.Frame parent, boolean modal) {
            super(parent, modal);
            initComponents();
        private void initComponents() {
            final BasePanel basePanel1 = new BasePanel();
            setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
            basePanel1.setBackground(java.awt.Color.white);
            basePanel1.setBorder(new javax.swing.border.EtchedBorder());
            getContentPane().add(basePanel1, java.awt.BorderLayout.CENTER);
            pack();
        public static void main(String args[]) {
            new bb(null, true).setVisible(true);
    }Even though I set the back colour of the panel WHITE, it does not turn into white when the dialog becomes visible. However, if I use JPanel instead of BasePanel while creating panel object, everything works fine. Is this a bug? I compiled and run the code above with both jvm version 1.4.02 and 1.5 beta 2, but the result is same.

    sure I did. I left it the class keyword out unintentionally. Furthermore, why shall I setVisible(true) of the BasePanel before packing it? It hasn't been done so in JPanel source code.

  • Custom JTree TreeCellRenderer with JPanel

    I have developed a custom TreeCellRenderer which extends JPanel to allow multple icons to be displayed and changed as the context changes. The JPanel has one or two icons and a JLabel which I control based on display context. The renderer works fine with one exception. If the initial string displayed beside the icons is short (such as 4 characters) when I try to display it with a longer string the JPanel does not resize to allow displaying the entire string. I've tried several variation to get the JPanel to resize. I've exanined the code in operation and it seems as though the size of the JLabel is being change correctly and the setPreferredSize on the JPanel is changing correctly. It just wont display without truncating the longer JLabel.
    I've reviews the forum to no avail.
    The code follows. Any thoughts are appreciated
    import javax.swing.ImageIcon;
    import java.awt.Image;
    import javax.swing.JLabel;
    import javax.swing.tree.TreeCellRenderer;
    import javax.swing.JTree;
    import com.logixpartners.planlogix.insuranceobject.*;
    import com.logixpartners.planlogix.utility.RtnObject;
    import java.awt.*;
    public class PLIconLabel extends javax.swing.JPanel implements TreeCellRenderer {
    ImageIcon a,b;
    int fWidth = 0;
    int sWidth = 0;
    String text = "";
    JLabel one, two, three;
    InsObject io;
    boolean selected;
    FontMetrics fontMetrics;
    int iconHeightPad = 0;
    int fontH, fontLen, iconH = 30+iconHeightPad;
    /** Creates a new instance of PLIconLabel */
    public PLIconLabel() {
    super(null); //null indicates no layour manager
    one = new JLabel();
    one.setIconTextGap(0);
    two = new JLabel();
    two.setIconTextGap(0);
    three = new JLabel();
    three.setIconTextGap(0);
    add(one);
    add(two);
    add(three);
    public void setIconOne(ImageIcon i) {
    a = i;
    fWidth = a.getImage().getWidth(this);
    one.setBounds(0,0, fWidth, a.getImage().getHeight(this)+iconHeightPad);
    if (b != null) {
    two.setBounds(fWidth,0,sWidth,b.getImage().getHeight(this)+iconHeightPad);
    three.setBounds(fWidth+sWidth+5,0,fontLen, iconH);
    one.setIcon(a);
    repaint();
    public void removeIconOne() {
    a = null;
    fWidth = 0;
    if (b != null) {
    two.setBounds(fWidth,0,sWidth,b.getImage().getHeight(this)+4);
    three.setBounds(fWidth+sWidth+5,0, fontLen, iconH);
    one.setIcon(a);
    repaint();
    public void setIconTwo(ImageIcon i) {
    b = i;
    sWidth = b.getImage().getWidth(this);
    two.setBounds(fWidth,0,sWidth,b.getImage().getHeight(this)+iconHeightPad);
    three.setBounds(fWidth+sWidth+5,0, fontLen, iconH);
    two.setIcon(b);
    repaint();
    public void removeIconTwo() {
    b = null;
    sWidth = 0;
    two.setIcon(b);
    two.setBounds(fWidth,0,0,0);
    three.setBounds(fWidth+sWidth+5,0,fontLen, iconH);
    repaint();
    public void setPLText(String t) {
    text = t;
    three.setText(t);
    fontMetrics = three.getFontMetrics(three.getFont());
    fontLen = fontMetrics.stringWidth(t);
    fontH = fontMetrics.getHeight();
    three.setBounds(fWidth+sWidth+5,0,
    fontLen+10,
    fontH);
    repaint();
    public java.awt.Component getTreeCellRendererComponent(JTree tree,
    Object value,
    boolean sel,
    boolean expanded,
    boolean leaf,
    int row,
    boolean hasFocus) {       
    try {
    io = (InsObject)value;
    } catch (java.lang.ClassCastException e) {
    e = e;
    setPLText(io.getBestName());
    if (io.getTypeOf().equals("Ref")){
    setPLText(io.getAttribute("Name"));
    // Setup colors for node selection
    if (sel) {
    setBackground(new java.awt.Color(64,128,128));
    } else {
    setBackground(new java.awt.Color(95,167,152));
    // Change text color of node
    three.setForeground(sel ? java.awt.Color.white : java.awt.Color.black);
    // Get proper Icon for Node
    if ((io.getClass().getName()).equals("com.logixpartners.planlogix.insuranceobject.InsObjectRef")){
    setIconTwo( (ImageIcon)((RtnObject)PLIcons.getIcon((String)io.getTypeOf())).getReturnValue());
    setIconOne((ImageIcon)PLIcons.get("RefPtr") );
    } else {
    removeIconOne();
    if (!expanded && !leaf) {
    setIconTwo( (ImageIcon)((RtnObject)PLIcons.getIconX((String)io.getTypeOf())).getReturnValue());
    } else {
    setIconTwo( (ImageIcon)((RtnObject)PLIcons.getIcon((String)io.getTypeOf())).getReturnValue());
    two.setToolTipText((String)io.getTypeOf());
    selected = sel;
    Dimension dim = new Dimension(three.getWidth()+60+fWidth+sWidth+20,iconH);
    setPreferredSize(dim);
    setMinimumSize(dim );
    setMaximumSize(dim );
    setSize(dim);
    validate();
    return this;
    }// end of class

    Addition to my original post. I found a forum post noting a similar problem. The suggest fix was to set the JTree row heigth to 0 (zero) and to add a getPreferredSize in the TreeCellRenderer, which gets called when row height is zero, and explicitly set the desired size. This works but with an exception. It seems as though the getPreferredSize is only called once when it is a leaf node being rendered. This seems to be true for expand, collaspe, and select.

  • Slides do not react

    Does anybody know why all of a sudden in the development module the exposure slide does not react - I can move it but it does not affect the picture. With this the hystogram remains unchanged. Other slides also do not react. I have logged out several times but the problem remains.
    Does anyone know how to solve this.
    many thanks
    luciana

    is this an adobe photoshop issue?

  • Toolbar Does Not React to Commands

    Running W7 and the latest Adobe Reader. When I download pdfs from OWA and some websites, the toolbar will not react to commands. Must first save the pdf to hard drive using a round about method, then reopen. I saw a similar thread with no response. Buehler?

    Hello there, JeBre.
    The following Knowledge Base article provides some great steps for troubleshooting the Apple Remote:
    Troubleshooting the Apple Remote
    http://support.apple.com/kb/HT1722
    Thanks for reaching out to Apple Support Communities.
    Cheers,
    Pedro.

  • Need help: commandLinks do not react anymore

    Hi
    I have the following problem:
    After some time of navigating through my webapp the commandLinks do not react anymore as expected. I use command links like this:
    <h:commandLink action="#{UserHandler.listFromBegin}" >
                          <h:outputText styleClass="commands" value="#{bundle.users_cmd_start}" />
                   </h:commandLink>  
                   <h:commandLink action="#{UserHandler.listPreviousRange}" >
                          <h:outputText styleClass="commands" value="#{bundle.users_cmd_previous}" />
                   </h:commandLink>  
                   <h:commandLink action="#{UserHandler.listNextRange}" >
                          <h:outputText styleClass="commands" value="#{bundle.users_cmd_next}" />
                   </h:commandLink>  
                   <h:commandLink action="#{UserHandler.listEnd}" >
                          <h:outputText styleClass="commands" value="#{bundle.users_cmd_end}" />
                   </h:commandLink>  
                   <br/><br/><br/><br/>
                   <h:commandLink action="home" >
                          <h:outputText styleClass="commands" value="#{bundle.users_cmd_home}" />
                   </h:commandLink>  
                   <h:commandLink action="#{UserHandler.prepareUserFormForAdd}"  >
                          <h:outputText styleClass="commands" value="#{bundle.users_cmd_add}" />
                   </h:commandLink>The methods bound in the action attribute always return the action that tells where to go next. But after a while of clicking aroung in the application, these methods are not called anymore. The logs then show this picture:
    2006-05-12 10:36:57,512 DEBUG [com.sun.faces.lifecycle.LifecycleImpl] - <execute(com.sun.faces.context.FacesContextImpl@254ae5)>
    2006-05-12 10:36:57,512 DEBUG [com.sun.faces.lifecycle.LifecycleImpl] - <phase(RESTORE_VIEW 1,com.sun.faces.context.FacesContextImpl@254ae5)>
    2006-05-12 10:36:57,512 DEBUG [com.sun.faces.lifecycle.RestoreViewPhase] - <Entering RestoreViewPhase>
    2006-05-12 10:36:57,512 DEBUG [com.sun.faces.lifecycle.RestoreViewPhase] - <New request: creating a view for /workflowusers.jsp>
    2006-05-12 10:36:57,512 DEBUG [com.sun.faces.lifecycle.RestoreViewPhase] - <Exiting RestoreViewPhase>
    2006-05-12 10:36:57,512 DEBUG [com.sun.faces.lifecycle.LifecycleImpl] - <render(com.sun.faces.context.FacesContextImpl@254ae5)>
    2006-05-12 10:36:57,512 DEBUG [com.sun.faces.lifecycle.LifecycleImpl] - <phase(RENDER_RESPONSE 6,com.sun.faces.context.FacesContextImpl@254ae5)>
    2006-05-12 10:36:57,512 DEBUG [com.sun.faces.lifecycle.RenderResponsePhase] - <Entering RenderResponsePhase>
    2006-05-12 10:36:57,512 DEBUG [com.sun.faces.lifecycle.RenderResponsePhase] - <About to render view /workflowusers.jsp>So after a while all requests are suddenly "new" requests and the Restore Phase proceeds directly to the Render Response Phase and thus leaves the Invoke Application Phase out.
    Can anybody please give me a hint where to search the problem?
    Thanks a lot!
    Regards.

    There is a bug with commandLink.
    What version are you using of JSF?
    If you use firefox and have the web developer tools you can see what is happening. You verify that the input hidden that contains the value of the commandlink submit value, probably have the wrong value after a while.

  • Adobe Audition does not playback any audio file. He opens it but does not react on the play key.

    Adobe Audition CC does not playback any audio file. He opens it but does not react on the play key. It is after use audio hardware usb wi-fi headphone and return to build-it out. The program don't react now.
    I see problem:
    I am unable to get playback at all in CS6 on Mac. The play button or spacebar will not move the playhead or make sound come out of the foamy things with the magnets. The play button toggles back and forth between green and white, but it isn't working. This is true in both multi track and waveform view.
    Anyone have ideas on what the issue could be? Thanks!
    Some Info:
    MacBook Pro 2.2 i7, 16GB RAM, 512GB SSD
    Mac OS 10.8.3
    Audition CS6 5.0.2 Build 5
    and reply:
    Best bet would be to go into Preferences > Audio Hardware, verify your input and output devices are correct, and probably switch your Master Clock to the opposite setting.  If that fails, we can continue troubleshooting.
    I have the same problem as the author writes. But these actions do not help

    Unfortunately I believe that requires purchasing the new version, and I do
    not have budget approval for such a purchase.
    On Tue, Jan 27, 2015 at 11:34 AM, Charles VW <[email protected]>

  • Why does Premiere Elements 12 not react, by trying to start movie over the timeline?

    I am using Premiere 12 Elements. Sometimes it happens, today again, that Premiere does not react anymore. It does not crash, I can add Effects oder cut the film, but I can not start the movie on the timeline.
    I tried to empty the cache and sometime it helps. But it can be, that it was only accedentely, that it worked then.
    My Computerconfig:
    Intel I7 Prozessor, 8 GB RAM, 2 Gigabyte HD, Win 8.1 64 bit, AMD Radeon HD5700
    I am happy for every answer, that helps.
    Thank you

    Are you working from the 12.1 Update of 12? If not, please do so using an opened project's Help Menu/Update.
    I have the actual Update on the Computer. After I installed it about two month ago, I updated it over th Updatebutton and Premiere says to me, that I have the latest Version. My Version is 12.1 (620140 225.12.1.620828).
    What is the size of the project when the Timeline playback is not possible? Is this event associated with any particular
    added effect, title creation, or video or audio transition placement?
    What do you mean with the size of the project? If you mean the size of the videoscreensize, I can give the information, that it is a Full HD Video.
    If you mean the size of the Projectdata, it is 994 Kb.
    In this project a keymask (4 points) is used, that a video from another track is visible with the mainvideo on Track one. And there are two faders in the video, thats all. No titles and so on.
    Where are the Scratch Disks directed and how much free hard drive space is at that location?
    Did you install the program to the default Local Disk C?
    Do you mean with Scratchdisks the path to the Cache? If so, I tried different pathes. On both Disks are 700 GB free space, butit did not make a difference. I emptied the cache, schanged the pathes, emptied again, but the result was the same. No reaction.
    I installed Premiere into the default given path during the installation. And that was c:\Program Files (x86).
    Video card/graphics card up to date according to the web site of the manufacturer of the card?
    For Device Manager/Display Adapters, is AMD Radeon HD5700 the only listing?
    Yes, the Videocard is up tp date, I compared my driver Version with the Version on the Website. It is the same . And there is only one Graphic Display in the Device Manager.
    When this event happens, how are you getting out of it so that you can move on in that opened project?
    I can use the program normal anyway. I can do everything I like, but I can not start the Video over the timeline. Even if I stop the program by leaving it over the regular menu, and doing a restart of the whole computer, the result is the same. The software runs, it loads all the sourcefiles, they are placed on the tmeline and I can do everthing, but not start the video on the timeline.

Maybe you are looking for

  • Palm Desktop 4.1.0 for Garmin iQue3600

    I have my Garmin iQue3600 synced with Palm Desktop version 4.1.0 which works fine with Vista but I can't use Help.  My iQue is dying and support has been totally discontinued, so I bought an iPod Touch to use as my PDA.  (I don't want a smartphone).

  • Powerpoint transitions in Captivate

    Hi Hopefully someone may be able to help with a quick query.  I have Captivate 5 (with latest updates) and also Powerpoint 2007 on one PC and Powerpoint 2010 on another.  I'm trying to upload a PowePoint document to Captivate which has been created i

  • ITunes is recognizing/using an OLD Library of mine.

    The Hard Drive (HD) of my iMac (2008) recently died, but I use an external HD to keep and organize all of my iTunes files. I had the HD replaced and I am in the process of setting up my computer as if it were new. Since my iTunes files and folders ar

  • Does the content of my podcast have to be available on I-Tunes?

    Hi all, I am about to enter the world of podcasting.. Before I do, I want to know if the tracks that I am using within my podcast have to be available to download through I-Tunes or can I use new promotional material that may not be relesed/ signed y

  • TS1387 IPOD Classic itunes sync issues.

    i cannot sync my music and photos to my ipod, and i get this message, i have tried to uncheck photo's but with no success!! Help me as i can stand being without my music?