JPanel in JTree not opaque ...

Hello it's me again, the guy nobody answers :-)
Well anyway solved my JTree Problem, but now I display panels as nodes but I do not get the panel to be opaqe - the panel is grey and the applet is white. It doesn't look well ...
If somebody knows the solution I'd be glad.
Thanks.

O.K. I got it, well I guess my English !good.

Similar Messages

  • Painting on a layer but the paint is not opaque..it is pale and transparent.  How can I get paint to be more intense and opaque to cover part of the picture?  I have a MAC and updated Photoshop CC.

    Why is any paint color I choose with paint brush not opaque while painting on a layer?  I want to cover or paint part of a picture on the first layer.  Using MAC and latest Photoshop CC

    Reset the Paint Tool as shown in the screenshot:
    If you are painting on a Layer, check the Opacity and Blend mode in the Layers Panel.  Blend Mode: Normal  Opacity and Fill: 100%
    Gene

  • The upper part of the page is not opaque, and the desktop shows through. Thus, the menu bar is hard to read. How to remedy this?

    The area behind the menu bar and the line above it, all the way across to the minimize, maximize and close icons is not opaque and the desktop and desktop icons show through. There is nothing I can find in Firefox Help to change this. Also, it would be nice if the menu bar could be made larger and more visible -- and if I could delete "Yahoo!" from the menu bar, leaving just the important items (File, Edit, View, History, Bookmarks, Tools, and Help). Any suggestions?

    See:
    *[[/questions/804050]]
    Right click in a free space on your desktop.<br />
    Left click on Personalization.<br />
    There are four options in Windows 7 at the bottom of the screen, choose "Window Color and Appearance".<br />
    Select a border color<br />
    Uncheck: "Enable transparency"<br />

  • My Top Bar is Not Opaque.

    My top bar is not opaque. Why? It's just like Tiger. How can I make it opaque?

    http://discussions.apple.com/thread.jspa?threadID=1197590&start=0&tstart=0

  • Why JPanel loaded is not shown up immediately???

    Dear Friends:
    I have a JPane to dynamically load other different JPanel at run time according to My click on different Tab, but my problem is that when I click the each diff Tab, the JPanel loaded is not shown up immediately,
    I must minimize whole application, then restore back to its original size, the loaded JPanel will show up,
    I used repaint() at the end of each loading, but did not take effect,
    How to solve this problem??
    Thanks
    sunny

    After add or removing components from a panel on a visible GUI you need to revalidate() the panel, so the LayoutManager can be invoked.

  • JPanel custom tooltips in JTree not showing

    Hi,
    I use a custom TreeCellRenderer in a JTree like
    MyTreeCellRenderer extends JPanel implements TreeCellRenderer
    The panel contains two JLabels, each with a different tooltip. Although I register the tree, the panel and the two labels with the tootipmanager, no tooltips are showing up. Any idea?
    Thanks,
    Ulrich

    I'll provide my own answer:
    As it currently stands Logic Apps require a "default" response to be defined in the swagger. This is not implemented by default by an API app out of the box, but can be done relatively easily by adding a Swagger OperationFilter.
    That is to say in the
    public void Apply(Operation operation, SchemaRegistry schemaRegistry, ApiDescription apiDescription)
    method of the filter you will need to ensure that the operation.responses dictionary contains an entry keyed with 'default'.
    Microsoft's provided connectors contain a reference to a "Microsoft.Azure.BizTalk.Adapters.SwaggerGenerator.dll" contains a OperationFilter that will do this for you if you don't want to write one yourself.
    Final note: Having spoken to MS about this issue it is currently under review and will hopefully be resolved in a future version of LogicApps so hopefully this will all disapear.
    Edit: Also see http://blogs.msdn.com/b/hosamshobak/archive/2015/03/31/logic-app-with-simple-api-app-with-inputs-and-outputs.aspx

  • How to make a JPanel transparent? Not able to do it with setOpaque(false)

    Hi all,
    I am writing a code to play a video and then draw some lines on the video. For that first I am playing the video on a visual component and I am trying to overlap a JPanel for drawing the lines. I am able to overlap the JPanel but I am not able to make it transparent. So I am able to draw lines but not able to see the video. So, I want to make the JPanel transparent so that I can see the video also... I am posting my code below
    import javax.media.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    import java.util.*;
    import java.lang.Math;
    import javax.media.control.FramePositioningControl;
    import javax.media.protocol.*;
    import javax.swing.*;
    class MPEGPlayer2 extends JFrame implements ActionListener,ControllerListener,ItemListener
         Player player;
         Component vc, cc;
         boolean first = true, loop = false;
         String currentDirectory;
         int mediatime;
         BufferedWriter out;
         FileWriter fos;
         String filename = "";
         Object waitSync = new Object();
         boolean stateTransitionOK = true;
         JButton bn = new JButton("DrawLine");
         MPEGPlayer2 (String title)
              super (title);
              addWindowListener(new WindowAdapter ()
                   public void windowClosing (WindowEvent e)
                            dispose ();
                            public void windowClosed (WindowEvent e)
                         if (player != null)
                         player.close ();
                         System.exit (0);
              Menu m = new Menu ("File");
              MenuItem mi = new MenuItem ("Open...");
              mi.addActionListener (this);
              m.add (mi);
              m.addSeparator ();
              CheckboxMenuItem cbmi = new CheckboxMenuItem ("Loop", false);
              cbmi.addItemListener (this);
              m.add (cbmi);
              m.addSeparator ();
              mi = new MenuItem ("Exit");
              mi.addActionListener (this);
              m.add (mi);
              MenuBar mb = new MenuBar ();
              mb.add (m);
              setMenuBar (mb);
              setSize (500, 500);
              setVisible (true);
         public void actionPerformed (ActionEvent ae)
                        FileDialog fd = new FileDialog (this, "Open File",FileDialog.LOAD);
                        fd.setDirectory (currentDirectory);
                        fd.show ();
                        if (fd.getFile () == null)
                        return;
                        currentDirectory = fd.getDirectory ();
                        try
                             player = Manager.createPlayer (new MediaLocator("file:" +fd.getDirectory () +fd.getFile ()));
                             filename = fd.getFile();
                        catch (Exception exe)
                             System.out.println(exe);
                        if (player == null)
                             System.out.println ("Trouble creating a player.");
                             return;
                        setTitle (fd.getFile ());
                        player.addControllerListener (this);
                        player.prefetch ();
         }// end of action performed
         public void controllerUpdate (ControllerEvent e)
              if (e instanceof EndOfMediaEvent)
                   if (loop)
                        player.setMediaTime (new Time (0));
                        player.start ();
                   return;
              if (e instanceof PrefetchCompleteEvent)
                   player.start ();
                   return;
              if (e instanceof RealizeCompleteEvent)
                   vc = player.getVisualComponent ();
                   if (vc != null)
                        add (vc);
                   cc = player.getControlPanelComponent ();
                   if (cc != null)
                        add (cc, BorderLayout.SOUTH);
                   add(new MyPanel());
                   pack ();
         public void itemStateChanged(ItemEvent ee)
         public static void main (String [] args)
              MPEGPlayer2 mp = new MPEGPlayer2 ("Media Player 2.0");
              System.out.println("111111");
    class MyPanel extends JPanel
         int i=0,j;
         public int xc[]= new int[100];
         public int yc[]= new int[100];
         int a,b,c,d;
         public MyPanel()
              setOpaque(false);
              setBorder(BorderFactory.createLineBorder(Color.black));
              JButton bn = new JButton("DrawLine");
              this.add(bn);
              bn.addActionListener(actionListener);
              setBackground(Color.CYAN);
              addMouseListener(new MouseAdapter()
                             public void mouseClicked(MouseEvent e)
                   saveCoordinates(e.getX(),e.getY());
         ActionListener actionListener = new ActionListener()
              public void actionPerformed(ActionEvent aae)
                        repaint();
         public void saveCoordinates(int x, int y)
                    System.out.println("x-coordinate="+x);
                    System.out.println("y-coordinate="+y);
                    xc=x;
              yc[i]=y;
              System.out.println("i="+i);
              i=i+1;
         public Dimension getPreferredSize()
    return new Dimension(500,500);
         public void paintComponent(Graphics g)
    super.paintComponent(g);
              Graphics2D g2D = (Graphics2D)g;
              //g2D.setComposite(AlphaComposite.getInstance(AlphaComposite.CLEAR, 0.0f));
              g2D.setColor(Color.GREEN);
              for (j=0;j<i;j=j+2)
                   g2D.drawLine(xc[j],yc[j],xc[j+1],yc[j+1]);

    camickr wrote:
    "How to Use Layered Panes"
    http://java.sun.com/docs/books/tutorial/uiswing/components/layeredpane.html
    Add your video component to one layer and your non-opaque panel to another layer.Did you try that with JMF? It does not work for me. As I said, the movie seems to draw itself always on top!

  • JPanel as TreeCellRenderer not shown

    Hello all,
    I'm experiencing a rather strange problem using a custom JPanel as a TreeCellRenderer for a JTree. Basically I needed to show a JLabel and an JTextArea inside a JScrollPane for each Node in my JTree. So I created a subclass of JPanel, implementing the TreeCellRenderer interface and registered it on the tree. The problem I experience is, that nothing is shown in my tree. Instead of the JPanel and its components I see a white space exactly the size of the JPanel, but no components in it. When I try to add my custom JPanel to a regular other panel, it shows up perfectly. My source code for the renderer looks like this (the text is statically provided at the moment, so each node should display the same amount of information):
    public class XMLTreeCellRenderer extends JPanel implements TreeCellRenderer
        private javax.swing.JLabel jLabel1;
        private javax.swing.JPanel jPanel1;
        private javax.swing.JPanel jPanel2;
        private javax.swing.JScrollPane jScrollPane1;
        private javax.swing.JTextArea jTextArea1;
        private void initComponents()
            jPanel1 = new javax.swing.JPanel();
            jLabel1 = new javax.swing.JLabel();
            jPanel2 = new javax.swing.JPanel();
            jScrollPane1 = new javax.swing.JScrollPane();
            jTextArea1 = new javax.swing.JTextArea();
            jLabel1.setOpaque(true);
            jLabel1.setHorizontalAlignment(SwingConstants.LEFT);
            jLabel1.setVerticalAlignment(SwingConstants.CENTER);
            setLayout(new java.awt.BorderLayout(10, 10));
            setOpaque(true);
            setBackground(new java.awt.Color(255, 255, 255));
            setMinimumSize(new java.awt.Dimension(140, 100));
            jPanel1.setLayout(new java.awt.BorderLayout(10, 10));
            jPanel1.setBackground(new java.awt.Color(255, 255, 255));
            jPanel1.setPreferredSize(new java.awt.Dimension(140, 20));
            jLabel1.setBackground(new java.awt.Color(255, 255, 255));
            jLabel1.setText("Testvalue");
            jPanel1.add(jLabel1, java.awt.BorderLayout.CENTER);
            add(jPanel1, java.awt.BorderLayout.NORTH);
            jPanel2.setLayout(new java.awt.BorderLayout(10, 10));
            jPanel2.setPreferredSize(new java.awt.Dimension(140, 80));
            jScrollPane1.setBorder(new javax.swing.border.EtchedBorder());
            jTextArea1.setEditable(false);
            jTextArea1.setToolTipText("Current Value");
            jScrollPane1.setViewportView(jTextArea1);
            jPanel2.add(jScrollPane1, java.awt.BorderLayout.CENTER);
            add(jPanel2, java.awt.BorderLayout.CENTER);
            validate();
            repaint();
        public XMLTreeCellRenderer()
            super();
            initComponents();
         * Returns the component that contains a rendered version of this node
         * @see javax.swing.tree.TreeCellRenderer#getTreeCellRendererComponent(javax.swing.JTree, java.lang.Object, boolean, boolean, boolean, int, boolean)
        public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus)
            LineBorder m_border;
            m_border = new LineBorder(Color.RED, 1, true);
            if (selected)
                setBorder(m_border);
            else
                setBorder(null);
            return this;
    }This is really driving me crazy. If I'm trying to return a simple JLabel, everything works ok, but whenever I want to show the JPanel, nothing happens.
    Thanks in advance for any suggestions,
    Sven

    Hello,
    no, I did not set a preferred size for the border; I did as shown in the code:
            m_border = new LineBorder(Color.RED, 1, true);
            if (selected)
                setBorder(m_border);
            else
                setBorder(null);
            }The only thing that I do is setting a minimum size.
    Sven

  • JTree not Updating - please help

    I am totally perplexed.
    I created a pretty standard implmentation of a JTree, utilizing the DefaultTreeModel, DefaultMutableTreeNodes, etc. The JTree is contained in a JScrollPane. The tree displays a string value that is one of the properties of the UserObject of the node, for which purpose I created my own subclass renderer and an editor. A JButton causes a new node to be added to the root node. All was working fine, until...
    I put the JTree and the TreeModel in a new class, along with the method to populate it. I created a method that passes a handle to the JTree ("getTree()") which I use to instantiate the JScrollPane ("new JScrollPane(tree)"). Now when I add a node to the root, it doesn't display!
    I have tried "tree.revalidate()", "tree.updateUI()", "scrollpane.revalidate()", "tree.repaint()", "dialog.repaint()" all to no avail. If I close the dialog and reopen it, everything displays fine.
    Can anyone tell me what I'm doing wrong?
    Thanks very much...

    Here are the two classes. Your help is greatly appreciated.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import javax.swing.tree.*;
    import java.util.*;
    public class CategoryMaintFrame extends AnyInternalFrame {
    private JDesktopPane desktop;
    private JFrame parentFrame;
    // CENTER
    private JScrollPane scroller;
    private CategTree categTree;
    private JTree cTree;
    private DefaultTreeModel theModel;
    // SOUTH
    private JPanel buttonPanel;
    private JButton addRootButton;
    private JButton cancelButton;
    private JButton okButton;
    private ActionListener al;
    // OTHER PROPERTIES
    private Project theProject;
    private AllCategories theCategs;
    private DefaultMutableTreeNode theRoot;
    private CategoryPopUp popUpMenu;
    // CONSTRUCTOR
    public CategoryMaintFrame(JDesktopPane pane, AllCategories categs, Project proj) {
    super("Global and Project-Specific Categories");
    desktop = pane;
    parentFrame = (JFrame) pane.getParent().getParent().getParent();
    theCategs = categs;
    theProject = proj;
    this.getContentPane().setLayout(new BorderLayout());
    buildGUI();
    setButtonListeners();
    setSize(400,300);
    addInternalFrameListener(new InternalFrameAdapter() {
    public void InternalFrameClosing(WindowEvent we) {
    CategoryMaintFrame.this.dispose();
    desktop.add(this);
    setVisible(true);
    private void buildGUI() {
    // NORTH, EAST & WEST
    JLabel fillerW = new JLabel("");
    fillerW.setPreferredSize(new Dimension(20,20));
    this.getContentPane().add(fillerW, BorderLayout.WEST);
    JLabel fillerE = new JLabel("");
    fillerE.setPreferredSize(new Dimension(20,20));
    getContentPane().add(fillerE, BorderLayout.EAST);
    JLabel fillerN = new JLabel("");
    fillerN.setPreferredSize(new Dimension(20, 20));
    getContentPane().add(fillerN, BorderLayout.NORTH);
    // CENTER: TREE
    // the Root is a non-data-based node created to root all of
    // the category trees
    theRoot = new DefaultMutableTreeNode("theRoot");
    categTree = new CategTree(theCategs, theProject);
    cTree = categTree.getTree();
    cTree.setEditable(true);
    cTree.setRootVisible(true);
    theModel = (DefaultTreeModel) cTree.getModel();
    scroller = new JScrollPane(categTree.getTree());
    this.getContentPane().add(scroller, BorderLayout.CENTER);
    // SOUTH: BUTTONS
    buttonPanel = new JPanel();
    addRootButton = new JButton("Add Root");
    buttonPanel.add(addRootButton);
    okButton = new JButton("Done");
    buttonPanel.add(okButton);
    getContentPane().add(buttonPanel, BorderLayout.SOUTH);
    private void setButtonListeners() {
    al = new ActionListener() {
    public void actionPerformed(ActionEvent ae) {
    if (ae.getActionCommand() == "Add Root") {              
    Category newCateg = new Category();
    newCateg.setTitle("<un-named>");
    newCateg.setProjectID(new Integer(0));
    newCateg.setProject(new Project(0));
    newCateg.setIsRoot(true);
    theCategs.addCategory(newCateg);
    DefaultMutableTreeNode newRoot = new DefaultMutableTreeNode(newCateg);
    ((DefaultTreeModel) cTree.getModel()).insertNodeInto(newRoot,
    theRoot, theRoot.getChildCount());
    theModel.reload(newRoot);
    } else if (ae.getActionCommand() == "Done") {
    CategoryMaintFrame.this.dispose();
    addRootButton.addActionListener(al);
    okButton.addActionListener(al);
    popUpMenu = new CategoryPopUp(theCategs, parentFrame, theProject);
    cTree.addMouseListener(popUpMenu);
    ((DefaultTreeModel) cTree.getModel()).addTreeModelListener(new MyTreeModelListener());
    class MyTreeModelListener implements TreeModelListener {
    public void treeNodesChanged(TreeModelEvent e) {
    System.out.println("model change detected");
    DefaultMutableTreeNode node;
    node = (DefaultMutableTreeNode)
    (e.getTreePath().getLastPathComponent());
    * If the event lists children, then the changed
    * node is the child of the node we've already
    * gotten. Otherwise, the changed node and the
    * specified node are the same.
    try {
    int index = e.getChildIndices()[0];
    node = (DefaultMutableTreeNode)
    (node.getChildAt(index));
    } catch (NullPointerException exc) {}
    Category chgdCateg = (Category) node.getUserObject();
    theCategs.changeCategory(chgdCateg);
    public void treeNodesInserted(TreeModelEvent e) {
    System.out.println("model insert detected");
    DefaultMutableTreeNode node;
    node = (DefaultMutableTreeNode) e.getTreePath().getLastPathComponent();
    if (!node.isRoot()) { // the root of the tree isn't a category; if
    // we added a node without a parent (a root category),
    // don't create a category relationship
    Category parCateg = (Category) node.getUserObject();
    try {
    int index = e.getChildIndices()[0];
    node = (DefaultMutableTreeNode) node.getChildAt(index);
    Category addCateg = (Category) node.getUserObject();
    theCategs.addCategory(addCateg);
    theCategs.addCategoryRelation(parCateg, addCateg);
    } catch (NullPointerException exc) {}
    public void treeNodesRemoved(TreeModelEvent e) { 
    System.out.println("model remove detected");
    DefaultMutableTreeNode anode, bnode;
    anode = (DefaultMutableTreeNode) e.getTreePath().getLastPathComponent();
    // get all of the children (not just immediate children) of the parent and
    // delete them
    Category delCateg;
    Vector allChildren = new Vector();
    Object[] nodeChildren = e.getChildren();
    // load the immediate children into a vector
    for (int i = 0; i < nodeChildren.length; i++) {
    anode = (DefaultMutableTreeNode) nodeChildren;
    allChildren.addElement(anode);
    boolean moreChildren = true;
    int i = 0;
    // iterate thru the vector, deleting the Categories, and adding their
    // children (if any) the end of the vector so they are likewise deleted
    while (moreChildren) {
    anode = (DefaultMutableTreeNode) allChildren.elementAt(i);
    delCateg = (Category) anode.getUserObject();
    // get this node's children, and store then in the vector
    Enumeration en = anode.children();
    while(en.hasMoreElements()) {
    bnode = (DefaultMutableTreeNode) en.nextElement();
    allChildren.addElement(bnode);
    theCategs.removeCategoryRelation(delCateg, (Category) bnode.getUserObject());
    // delete it from the collection and the database
    theCategs.deleteCategory(delCateg);
    delCateg = null;
    anode = null;
    i++;
    if (i >= allChildren.size())
    moreChildren = false;
    public void treeStructureChanged(TreeModelEvent e) {
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    import java.awt.*;
    import javax.swing.*;
    import javax.swing.tree.*;
    import java.util.*;
    public class CategTree {
    private JTree cTree;
    private DefaultTreeModel theModel;
    private Project theProject;
    private AllCategories theCategs;
    private DefaultMutableTreeNode theRoot;
    // CONSTRUCTOR
    public CategTree(AllCategories categs, Project proj) {
    super();
    theCategs = categs;
    theProject = proj;
    // the Root is a non-data-based node created to root all of
    // the category trees
    theRoot = new DefaultMutableTreeNode("theRoot");
    theModel = new DefaultTreeModel(theRoot);
    cTree = new JTree(theModel);
    CategoryNodeRenderer cnr = new CategoryNodeRenderer();
    cnr.setPreferredSize(new Dimension(200,20));
    cTree.setCellRenderer(cnr);
    cTree.setCellEditor(new CategoryNodeEditor(cTree, cnr, theCategs));
    cTree.setEditable(false);
    cTree.setRootVisible(false);
    cTree.setExpandsSelectedPaths(true);
    cTree.setScrollsOnExpand(true);
    cTree.setShowsRootHandles(true);
    cTree.setToggleClickCount(0);
    cTree.setVisibleRowCount(20);
    initializeTreeModel();
    public DefaultTreeModel getTreeModel() {
    return theModel;
    public JTree getTree() {
    return cTree;
    public DefaultMutableTreeNode getRootNode() {
    return theRoot;
    public void initializeTreeModel() {
    Vector allNodes = new Vector();
    // insert all of the root categories in the root of the tree and
    // store a ref to the node in a vector
    Vector allRoots = theCategs.getAllRoots(theProject);
    for (int i = 0; i < allRoots.size(); i++) {
    Category nextRoot = (Category) allRoots.elementAt(i);
    DefaultMutableTreeNode nextNode = new DefaultMutableTreeNode(nextRoot);
    theModel.insertNodeInto(nextNode, theRoot, theRoot.getChildCount());
    allNodes.addElement(nextNode);
    // now insert the children of each node in the vector in the tree, and store
    // it in the vector, incrementing to the end of the vector
    // int totalNodes = theCategs.getCategoryCount();
    boolean moreNodes = allNodes.size() > 0? true : false;
    int i = 0;
    while (moreNodes) {
    DefaultMutableTreeNode nextParent = (DefaultMutableTreeNode) allNodes.elementAt(i);
    Category parentCateg = (Category) nextParent.getUserObject();
    Vector children = theCategs.getParentsChildren(parentCateg, theProject);
    for (int j = 0; j < children.size(); j++) {
    Category nextChild = (Category) children.elementAt(j);
    DefaultMutableTreeNode nextNode = new DefaultMutableTreeNode(nextChild);
    theModel.insertNodeInto(nextNode, nextParent, nextParent.getChildCount());
    allNodes.addElement(nextNode);
    i++;
    if (i >= allNodes.size())
    moreNodes = false;
    theModel.reload();
    public void expandAllPaths() {
    Enumeration e= theRoot.depthFirstEnumeration();
    while (e.hasMoreElements()) {
    DefaultMutableTreeNode node = (DefaultMutableTreeNode) e.nextElement();
    cTree.makeVisible(new TreePath(node.getPath()));

  • JLabel ImageIcon not opaque.

    Hi I am having a little problem with my program that I am trying to develop.
    I have created a JFrame and instead of having the background the usual grey I have used an image.
    I then wanted to create some nice big buttons with nice smooth curved edges but was having trouble using the JButton so decicded to use a JLabel and attach a MouseListener to it. This seems to be working fine at the mo.
    The only problem is that instead of my nice gradient filled background being displayed I get a big white border around the JLabel. The rest of the background is perfectly displayed having only a problem around the JLabel. I have tried not using a background image and it shows the JLabel correctly and the button looks nice and smooth.
    I think it might be something to do with the rendering sequence maybe but I am at a loss. If any one has any ideas on how to fix it or a better way of doing it I would be most grateful.
    Many thanks for your help in advance.
    Matt
    PS now heres my code:
    public class GUI extends JFrame implements MouseListener {
         ImageIcon icon;
         JPanel buttonPanel = new JPanel();
         public GUI(){
              super("Property Works - Estate Agent Management System");
              icon = new ImageIcon("images/bg.jpg");
              JPanel panel = new JPanel(){
                   protected void paintComponent(Graphics g){
                        //g.drawImage(icon.getImage(), 0, 0, null);
                        Dimension d = getSize();
                        //g.drawImage(icon.getImage(), 0, 0, d.width, d.height, null);                    
                        super.paintComponent(g);                    
              panel.setOpaque(false);
              addButton();
              panel.add(buttonPanel);
              getContentPane().add(panel);
              setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              setExtendedState(JFrame.MAXIMIZED_BOTH);
              setVisible(true);
         public void addButton(){
              ImageIcon icon1 = new ImageIcon("images/buttons/addProperty.gif");
              JLabel addProperty = new JLabel(icon1);
              addProperty.setOpaque(false);
              addProperty.setToolTipText("Add a new property");
              addProperty.addMouseListener(this);
              JLabel tester = new JLabel("Tester");
              tester.setOpaque(false);
              buttonPanel.add(addProperty);
              buttonPanel.add(tester);     
         public void mousePressed(MouseEvent arg0) {
              // TODO Auto-generated method stub
              System.out.println("Button Clicked");
    }

    Swing related questions should be posted in the Swing forum.
    Use the "code" tags when you post code so the formatting is retained.
    The code you posted doesn't compile so we can't see the incorrect behaviour.
    Using code I already have I do not see any white border around the image. I tested using a "Duke" image which is found in many of the Swing tutorial examples. Maybe your image is the problem.

  • Help with JTree's opaque methods

    I have been looking through the methods provided for JTree in Netbeans GUIBuilder and I do not see accessor methods for actions like insertion, retrieval, deletion and replacement. I am looking for something like this.
    JTree.insert('object', JTree.getSelectedNode());
    JTree.getSelectedNode().getObject();
    JTree.deleteNode(JTree.getSelected());
    JTree. supplantObject(‘object’, JTree.getSelectedNode());
    JTree.insert('object', JTree.getSelectedNode()) should accept to inputs; the object you wish to insert and the location you wish to insert it. JTree.getSelectedNode() would be an accessor method returning the selected node. The insert would have to find the next available element in the LinkedList, array, hashtable, stack, (or whatever it uses) and inserts the object.
    JTree.getSelectedNode().getObject(); I assume that if I have “apple” selected in the JTree, “apple” will be returned.
    JTree.deleteNode(JTree.getSelected()); deleting the node wipes out all its children as well.
    JTree. supplantObject(‘object’, JTree.getSelectedNode()); overwrites the object in the selected with a new object.
    These seem like the more obvious accessor methods and I am astonished to find them missing or named something inconsistent with java standards.
    So I guess my question is, what are the equivalent method names for the aforementioned methods?
    BM

    Take a look at [http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/tree/DefaultMutableTreeNode.html|http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/tree/DefaultMutableTreeNode.html] which has most of the methods that you are interested in. A JTree has a single root node, which by default is of this type.

  • JTree not showing plus/minus signs

    Hi,
    I'm having a strange problem with JTree when implementing my own DefaultTreeCellRenderer: the renderer is shown correctly, but the plus and minus signs are gone!
    My getTreeCellRendererComponent implementation actually creates a new JPanel and returns it instead of the default one. Can that be the problem? How can I make these plus/minus signs come back?
    Thanks, U

    I have seen something a little different on my CustomCellRenderer where the plus minus sign is replaced with some default arrow icon and where it comes from I have no clue. I basically have a 3 level deep tree and its at the B level where this icon appears.
    http://www.matthewscorp.com/images/JTreeError.jpg
    For the life of me I can't figure this one out. I have tried all ideas like set all the renderer icons or the LAF properties icons and still this blue arrow appears. Any ideas would help on both mine and the original poster.

  • JTable on JPanel on JFrame, not appearing

    I can't see the JTable that I was expecting to between the two labels, any ideas why?
    public class Workout extends JFrame {
            final String[] exercisesDoneColumnNames = {"Exercise", "# Sets", "Set 1", "Set 2", "Set 3", "Set 4", "Set 5", "Set 6", "Set 7", "Set 8", "Set 9", "Set 10"};
            private ExercisesDoneTable myModel = new ExercisesDoneTable exercisesDoneColumnNames,0);
            private JTable table = new JTable(myModel);
            public Workout() {
                super.setTitle("Workout");
                buildExerciseDoneTable();
                Toolkit tk = Toolkit.getDefaultToolkit();
                Dimension d = new Dimension();
                d = tk.getScreenSize();
                setSize((int)d.getWidth(), (int)d.getHeight());
                setLocation(0,0);
                super.setName("Workout");
                addWindowListener(new java.awt.event.WindowAdapter() {
                    public void windowClosing(java.awt.event.WindowEvent evt) {   
                        System.exit(0);
                JPanel p = new JPanel();
                p.setBackground(java.awt.Color.white);
                p.add(new JLabel("left of"));
                p.add(table);
                p.add(new JLabel("right of"));
                getContentPane().add(p);
                setVisible(true);
        //helper method just splits the code to make it more readable
        private void buildExerciseDoneTable(){
            table.setPreferredScrollableViewportSize(new Dimension(500,100));
            myModel.addTableModelListener(myModel);
            table.setVisible(true);
        }

    JPanel has a default FlowLayout.
    I think you table is there, but is not displaying anything as you have specified 0 rows when creating your table model. Change that number to 1 and you will see it appear.

  • JTree not updating

    i've already make changes to the nodes in a jtree, then i try using
    jtree.repaint();, jtree.validate();, all didn't update the display..
    why is it like that?
    i try using jtree.updateUI(), it works but got some problem when calling from other class(can't understand the reason) it give this error:
    java.lang.NullPointerException
         at javax.swing.plaf.basic.BasicTreeUI.paintRow(BasicTreeUI.java:1309)
         at javax.swing.plaf.basic.BasicTreeUI.paint(BasicTreeUI.java:1120)
         at javax.swing.plaf.metal.MetalTreeUI.paint(MetalTreeUI.java:139)
         at javax.swing.plaf.ComponentUI.update(ComponentUI.java:39)
         at javax.swing.JComponent.paintComponent(JComponent.java:395)
         at javax.swing.JComponent.paint(JComponent.java:687)
         at javax.swing.JComponent.paintWithBuffer(JComponent.java:3878)
         at javax.swing.JComponent._paintImmediately(JComponent.java:3821)
         at javax.swing.JComponent.paintImmediately(JComponent.java:3672)
         at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:370)
         at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(SystemEventQueueUtilities.java:124)
         at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:154)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:337)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:131)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:98)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
         at java.awt.EventDispatchThread.run(EventDispatchThread.java:85)

    I suppose you are adding/removing nodes of the tree using a TreeModel or TreeNode
    So then calling updateUI may not be good enough
    You should be firing the events fireTreeNodesRemoved/fireTreeNodesInserted
    You can do the same using the methods nodesWereRemoved/nodesWereInserted
    of TreeModel
    Incase you are just changing some properties of the node , You may use nodesChanged

  • Help Menu Search Bar Transparency Not Opaque With Increase Contrast Option

    Hi,
    I am running OS X 10.10 and I've turned on the Reduce Transparency and the Increase Contrast options.
    I've noticed, however, that with the Increase Contrast On the background of the search bar in the Help menu is transparent again and with black text (making it even harder to read then normal). If I have only the Reduce Transparency on then it is opaque as expected. It's with both Reduce Transparency and Increase Contrast on that causes this behavior.
    Is this a bug that anyone else has experienced or is it just me? Any ideas how to fix this annoyance (other than turning off Increase Contrast)?
    Thanks

    I'm having the same problem here. Not really sure why it's not working, but checking the "synchronize with google" box seems to do nothing.

Maybe you are looking for

  • Error in filling the table.

    Hi to all         I am trying to fill the setup table for 2lis_03_bf.But i am getting the following error : No extract structure active or no bw connected. when i intimated to onsite team this very simple issue i ahve to active the D.S.When i checked

  • Confirmation issues, Error in Process

    We are getting the following error in SRM system when doing confirmations, any ideas guys Error whilst creating an entry sheet in the backend system 0000026433 117 General error during acceptance posting This then dispays as an error in process??? Re

  • Two Images in PDF (background image)

    Greetings Trying to replace an existing image in a report from filesystem and this replace an existing loaded image into the reports. This image should come as back of the photo for an ID Card. As it comes from the file system it pushs the photo in t

  • Iphone wont update to ios 6.0.1

    I am trying to update my iPhone 4 16gb to iOS 6.0.1. My iPhone is currently running iOS 4.3.3. I plug it in to my computer, iTunes recongizes it and tells me there is an update for it. so i proceed with it. I was able to download the OS but was unsic

  • How to Create DR (Disaster Recovery) and/or SB (Stand by) in 9i

    Dear All, I have to ask how can I create SB & DR. I have a database for which I need SB and DR. Please help me in this regard. Aqeel Nawaz