Xp: bug: jbutton: transparent + no border

hi,
we have tested our swing-application under win-xp and must see that the jbuttons doesn't be shown correctly. this problem does exist only under win-xp. in win9x, winnt, win2k it works perfectly.
we use own designed buttons with transparent gif's and no borders. here is an example:
(look+feel = system)
ivjButNext = new javax.swing.JButton();
ivjButNext.setName("ButNext");
ivjButNext.setBounds(350, 5, 103, 42);
ivjButNext.setOpaque(false);
ivjButNext.setBackground(new java.awt.Color(0,100,255));
ivjButNext.setForeground(java.awt.Color.black);
ivjButNext.setIcon(new javax.swing.ImageIcon(getClass().getResource("but_1.gif")));
ivjButNext.setPressedIcon(new javax.swing.ImageIcon(getClass().getResource("but_2.gif")));
ivjButNext.setDisabledIcon(new javax.swing.ImageIcon(getClass().getResource("but_3.gif")));
ivjButNext.setFocusPainted(false);
ivjButNext.setBorderPainted(false);
ivjButNext.setFont(new java.awt.Font("Arial", 1, 12));
ivjButNext.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
ivjButNext.setText(resLocale.getString("next"));
ivjButNext.setSelected(true);we get the following problems
1. the buttons will not be transparent. we don't know if the gif not be shown correctly or the button-background.
2. the border is still visible. the borderpainted/focuspainted-command doesn't work correctly
thx for prof. answers
oliver

It is because XP laf doesn't have the same behavior as previous Wndows laf (skins!).
if you want to have your own design change the UI for the buttons :
JButton b = new JButton("Test");
b.setUI(new BasicButtonUI());
b.setBorder(BasicBorders.getButtonBorder()); // don't forget for buttons only
JToggleButton tb = new JToggleButton("Test");
tb.setUI(new BasicToggleButtonUI());If you want to set it for all buttons:
try {
     UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
catch (Exception e) {
     e.printStackTrace();
UIManager.put("ToggleButtonUI", "javax.swing.plaf.basic.BasicToggleButtonUI");
UIManager.put("ButtonUI", "javax.swing.plaf.basic.BasicButtonUI");(don't forget to set also the border for the JButtons if you want it)
Denis

Similar Messages

  • BUG: iPad displays 1cm border around content in task flow popup window

    I have tried this out on JDeveloper 11.1.1.6.0, 11.1.2.1.0 and 11.1.2.2.0 and each one seems to have the same problem. When displaying a taskflow in-line popup windows on an iPad (iOS 4.3.5 and iOS 5.1) a ~1cm border is displayed on the left, bottom and top of the window's content, with some of the content (also about 1cm) on the right being cut-off.
    I have also tried my app out on a Android Samsung Galaxy Tab (built-in browser), Android Samsung S1 (built-in) and on my Windows 7 PC in Safari and Firefox. None of these devices/browsers have this problem.
    To replicate this problem the following steps can be followed.
    1) Create a normal fusion web application.
    2) Add a wild card control flow rule to the default unbounded task flow.
    3) Add a new bounded task flow to the unbounded task flow.
    4) Set the bounded task flow 'Run as Dialog' to 'true' and 'Display type' to 'inline popup'.
    5) Link the wild card control flow to the bounded task flow.
    6) Add a single jsf page to the bounded task flow.
    7) Add a panel box to the jsf page (or any other content for that matter)
    8) Create a test page and add a button to it. Set up the button's action properties such that it opens the bounded task flow as a window ('UseWindow' - 'true'; 'WindowEmbedStyle' - 'window'; 'WindowModalityType' - 'modeless' and set width and height).
    Are any workarounds for this? Is there currently a available patch to fix this problem?

    Hi,
    Are any workarounds for this? Is there currently a available patch to fix this problem?
    if nobody dares reproducing this and filing it as a bug then a fix can take a while. I'll put it on a list of my follow ups, but this is not a high priority list. So if you can I appreciate if you can file the bug and provide a testcase. Note that 11.1.2 (11g R2) is not yet optimized for tablet PCs. So JDeveloper 11g R1 (11.1.1.6) is the build that should be used as a reference for filing the bug
    Frank

  • Strange bug - flashing transparent rectangles

    Hello - I've just upgraded to a 2.4 ghz imac, 2gb RAM, Radeon HD 2400 graphics card, OSX 10.5.6. I've been trialling Photoshop CS4 and occasionally notice a random bug - (I haven't been able to identify what sets it off - sometimes just making a layer invisible then visible, or selecting an area with the lasoo) - transparent (ie. grey/white chequered) rectangles start appearing as the screen redraws, and parts of the image start blurring and shimmering. I quit, restart, and all is fine again for a few hours, and then it starts again?! The files I'm working on are by no means massive - 35MB . Any idea if it is a RAM or graphics card or Adobe or Mac or ? issue?! I'm also using an old Wacom with current driver - I haven't experienced this problem in any other program, though. Many thanks!

    The last external harddisk I bought privately was an IOMEGA 750 GB with all the alternatives for ports on it. I am very happy with it. That one is partitioned into 2 halves, one housing my Mac Book backup, the other housing my iMac backup. The original plan for that disk was not for backup, but for working (and I used it until recently for startup disk for various betas I didn't want to mix with my regular stuff)and for scratch.
    But along came the Mac Book alu (2,4 GHz) at work which replaced my black MacBook (2,16 GHz). Not my choice, but that was what we got (I would have preferred the new Mac Book Pro alu WITH FW). (We are also going to combine those with iPhones instead of regular SonyEricsson mobiles and regular phones before March - around 700 iPhones we are talking about - we are becoming entirely mobile, except for the editors which will get iMac 24" instead of the present old G5s).
    We (the Helpdesk of Scandinavias largest daily newspaper) are trying out the MacBook alus before we swop all the current MacBook and MacBook Pro users to them (several hundred users)during the coming spring (when we also switch to Leopard and CS3-CS4, CS3 for the editors (because of plug-in development for the publishing systems we use), CS4 for the photographers probably as they got brand new very advanced CANON cameras recently).
    So now my external harddisk for scratches is a meager 160GB LaCie with firewire only (which also houses one backup of my photos in addition to dvds) which I cannto use at all with my Mac Book Alu.
    Without the IOMEGA with all the ports on it I would not have been able to migrate my MacBook to the new Mac Book Alu as easily and fast as I did. My collegues struggled with it over the network by wireless hub and Airport for whole days.
    Conclusion: if you can find one with both USB2 and firewire all the better for the future. That's what I am looking for personally. But I only see usb 2 ones in all the stores (unless I go to Apple store and pay a lot more than in a regular electronics store like MediaMarkt). The Swedish Apple Store has a IOMEGA 1TB Minimax with both firewire and usb that looks interesting. Reading specs though tells me that USB 2.0 is faster than the firewire 400 in it. FW 800 is not present on all machines. I guess a Western Digital 1TB My Book Studio Edition with both fw400 and 800 and usb 2.0 gives you more for the money. Or a Iomega UltraMax Desktop Hard Drive 750GB And in the long run is a better investment regardless of which machines it will be connected to in the future.

  • JButton with no border

    I simply want a button to show an icon without having any space around that icon. For some reason, the button always has a border around the icon that I cannot get rid of. I have tried setting the button's border to EmptyBorder and setMargin to 0,0,0,0 and other things but the border is alway there. When I mouse click on the button, I can click on space outside of the icon and still have a button event which is not what I want. Any ideas?

    This code worked for me. I just went negative on the spacing.
    buttons = new JButton();
    buttons.setMargin(new Insets(-3, -3,-3,-3));
    //sets the margin so buttons touch
    buttons.setBorderPainted(false);//turns off the borders
    buttons.setFocusPainted(false);
    buttons.setContentAreaFilled(false);
                   

  • Weird bug?  Transparent background is black instead of checkerboard in RGB mode

    If I try to make a new RGB document with the Background Contents set to Transparent the canvas is filled with black instead of the checkboard pattern.  However over in the Layers window the little icon for the layer shows it as transparent with the checkerboard. In the Channels window it also appears transparent, and if I click on one of the channels which selects just one of them the canvas changes from black to the checkboard.  If I click on the RGB channel at the top the canvas changes to black again.
    Why is this happening and how do I fix it?
    If I open a new document in CMYK I get the checkerboard like I'm supposed to.
    I bought a new PC a few days ago and this is a fresh install of Adobe CS4 on Windows 7.  Photoshop is updated to version 11.0.2.
    I could swear this wasn't happening a couple of days ago when I first installed it, and it never happened on my old XP computer. 
    edit to add: all files show a black background in RGB mode instead of the checkerboard pattern, not just when creating a new document.

    What are the Photoshop > Preferences > Transparency & Gamut > Transparency Settings?
    Boilerplate-text:
    Does turning off OpenGL in the Performance Preferences and restarting Photoshop have any bearing on the issue?
    Other than that are Photoshop and OS fully updated and have you performed the usual trouble-shooting routines (trashing prefs by keeping command-alt-shift/ctrl-alt-shift pressed while starting Photoshop, 3rd party plug-ins deactivation, system maintenance, font validation, etc.)?

  • Bug wmode=transparent in Firefox

    Hello!
    Starting from version 10.1.53.64, had such a problem:
    text data is displayed with a blue frame. Sample.
    The error occurs when the option is enabled wmode = transparent.
    Firefox 3.6.8 (without plugins)
    Windows XP

    I do not know what causes an error.
    It is noticed that the videos, if you turn this option would be a mistake on my computer.
    I tried to reproduce the problem on another computer. It works without errors.

  • JButton with invisible border

    Hi experts,
    I would like to have an 'invisible button' that only shows the button text and have that text become 'bold' when rolled over. Any suggestions? Thanks much.
    hopi

    Hi experts,
    I would like to have an 'invisible button' that only
    shows the button text and have that text become
    'bold' when rolled over. Any suggestions? Thanks
    much.
    hopiyou can add an actionListener (like mouseEntered, mouseExited) and use the setFont("fontname", Font.BOLD, dim); method.

  • Flash update Jan 2014 in Chrome CSS Border-radius BIG TIME bug !

    Please confirm and fix !
    Jan 30 2014
    Chrome Version : 32.0.1700.72
    Operating System: Windows 7 through 8.1
    Several days ago Chrome updated its Flash player to version 12 and it introduced a bug somewhere.
    Setting border-radius to a flash object will make it vanish.
    <object type="application/x-shockwave-flash" data="test.swf" style="border-radius:1px"/>
    It works on Firefox with flash player 12, it also works on Chrome with flash player 11, but it stopped working several days ago when FP 12 was added to chrome.

    You have posted to the Shockwave forum which, despite the title, has nothing to do with Shockwave Flash. Please post to a Flash-related forum

  • Questions about exporting PSDS(so as PNG, TIFF with transparency) by AI CS4 and newer

    Hello, I've got this question as titled...I stll can't figure it out why.
    I'm now using WIN version of AI CS6, and I've used CS4, CS5 before.
    Why does AI CS4(and the newers) export transparent PSD files which are always with blank transparent thin border(about 2~3px) line in the right and down side ?
    This situation hasn't happened in CS3 and CS2.
    The PSD files I intended to export are about A4 size with 300 dpi, sometimes with 150dpi, in RGB/CMYK/Grayscale color modes.
    If  someone as well-experienced as all you seniors can tell me the reason or even solutions i'll be very thankful to your reply.

    Thank your reply first
    I totally agree with your opinion, it's really an annoying bug.
    I've tried your solutions before but it's still time-comsuming to correct the with/length.
    Sometimes I think the new version AI kind of rediculous because it can't export as accurate as the CS2/CS3's exporting, which should have functioned well.
    On the other hand, I can also save my AI file with PDF capability and drag it into PS to rasterize, then I can get accurate PSD files.
    But save AI with PDF cab. takes much time, even more when there are complex objects (or) with multiple appearance features and occasionally fails to save and get a broken AI file.

  • JButton can not fire ActionEvent

    Hi,
    There is a problem found on JRE 1.5 Update 4on Windows XP for a JButton in my application.
    Here is the short description of the app.
    There are ImageIcons loaded into JButtons. There JButtons are added to a JPanle. The JPanle is then add to a JScrollPane. The scroll pane itself is added as a menu item for a Popmenu. When I click the image icon of the button, it will invoke the action listener's actionPerfromed method. The action listener has been earlier added to the JButtons.
    It workked with JRE 1.4.0 but it fail witj JRE 5.0 Update 4. It is like a bug to me. Or the JButton class stops deliver action events when it is part of a menu item. Any idea why?
    J.

    Hey, good morning, Jaspre
    I found a mistake in my problem statement. You should add a JMenu to the JPopupMenu and add the JScrollPane to the JMenu.
    Maybe the code should not add a JMenu to a JPopupMenu, but it's there in the code. Below is a test which I modify from yours. It does not show the dialog on 1.5.0.4 runtime.
    This test case also shows 2 other possible bugs.
    1.The border text for the JButtons do not position at the right place using JRE 1.5.0.4.
    2.The JScrollPane's behaviour is very strange so that users' experience will not be satisfied.
    For each description, please run it against JRE 1.4.0 and 1.5.0.5 to see what I mean.
    Thanks
    Jack
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class ButtonTest extends JFrame
         public ButtonTest() {
              super("ButtonTest");
              ActionListener al = new ActionListener() {
                   public void actionPerformed(ActionEvent e) {
                        JOptionPane.showMessageDialog(ButtonTest.this,
                             "Clicked " + ((JButton)e.getSource()).getText());
            JPanel panel = new JPanel();
            GridBagConstraints c = new GridBagConstraints ();
            c.fill = GridBagConstraints.BOTH;
            c.weightx = 1 ;
            c.weighty = 1 ;
            GridBagLayout layout = new GridBagLayout();       
            panel.setLayout(layout);
              JButton b;
              for (int i = 0; i < 10; i++) {
                   b = new JButton("Button-"+(i+1));
                   b.addActionListener(al);
                   c.gridx = 0 ;
                 c.gridy = i ;
                 layout.setConstraints(b,c);
                 b.setBorder (BorderFactory.createTitledBorder
                         (b.getBorder (), "border")) ;
                   panel.add(b);
              JScrollPane scroller = new JScrollPane(panel);
              scroller.setPreferredSize(new Dimension (200,500));
              final JPopupMenu menu = new JPopupMenu();
              JMenu submenu = new JMenu();
              menu.add(submenu);
              submenu.add(scroller);
              getContentPane().addMouseListener(new MouseAdapter() {
                   public void mousePressed(MouseEvent e) {
                        popup(e);
                   public void mouseClicked(MouseEvent e) {
                        popup(e);
                   public void mouseReleased(MouseEvent e) {
                        popup(e);
                   private void popup(MouseEvent e) {
                        if (e.isPopupTrigger())
                             menu.show(e.getComponent(), e.getX(), e.getY());
              setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
              setSize(600, 400);
         public static void main(String[] args){
              ButtonTest bt = new ButtonTest();
              bt.setLocationRelativeTo(null);
              bt.setVisible(true);
    }

  • Can't make JButton borders in Windows invisible

    Hi all,
    I know variations on this question have been asked before, but all I was able to find were answers regarding how to make the contents of a JButton transparent in Windows, and not the borders.
    I have a JButton with an imageIcon in it (though the bug appears with text as well). I want to make the entire button invisible so that only the icon (or text) shows. I have set bordersPainted(false), opaque(false) and contentAreaFilled(false), but I still get a white boarder around my button in Windows (on a Mac there is no problem). Self-contained example attached.
    Does anyone know the best way to solve this? I'd prefer not to have to set the whole L&F, as there is a lot of othe rSwing stuff in this app that I don't want to mess with, and I'd prefer not to have to set the L&F for all JButtons either, but a custom class for these specific JButtons might be ok, if necessary.
    Thanks for any advice,
    Sam
    Example:
    import javax.swing.*;
    import java.awt.*;
    public class SwingTest {
         public SwingTest(){
              JFrame f = new JFrame();
             f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
             f.getContentPane().add(createTesterPanel());
             f.setPreferredSize(new Dimension(200,200));
             f.pack();
             f.setVisible(true);
         private JComponent createTesterPanel(){
              JPanel wrapper = new JPanel();
              wrapper.setBackground(Color.BLUE);
              JButton button = new JButton("test");
              button.setPreferredSize(new Dimension(50,50));
              button.setBorderPainted(false);
              button.setOpaque(false);
              button.setContentAreaFilled(false);
              wrapper.add(button);
              return wrapper;
      public static void main(String[] args) {
        SwingTest st = new SwingTest();
    }

    Encephalopathic wrote:
    edit: also look into: button.setFocusPainted(false);
    Cool, that worked, thanks! I hate getting into the nitty-gritties of OS Look and Feels...
    Thanks a lot.
    @ Darryl.Burke: Thanks :) My nick is the same that I've had since the ancient days of hotmail addresses and not knowing what flame wars were (such innocence!). I get that question a lot though. ;)

  • 2 Bugs in PDF Form Field Rendering

    Both of these bugs appear when "Show border hover color for fields" is on.
    In XObject streams used for Text Widget Annotation appearences the BMC operator does not properly respect whitespace. To reproduce:
    Create a fillable form field with a text widget annotation.
    Fill in text in the field, save the document
    Edit the content stream of the appearance stream used for the widget so that there are two spaces between /Tx and BMC instead of 1.  Be sure to shorten the content stream by 1 byte (shorten a string by a byte or remove a leading 0 in a decimal) when making the change so as not to change offsets.  Save the file.
    Open the file in Acrobat and note the text doesn't appear.  Turn "Show border hover color for fields" off and the text appears.
    In XObject streams used fo all WidgetAnnotations, the general color operators, CS, cs, SC, and sc are not respected.
    Create a fillable form field that uses /DeviceGray SC 0 sc to set the text color (this can be done by create a text field and filling it with a lot of repeating non-white space characters and then replacing the 0 g with /DeviceGray 0 sc then shortening the text string to keep the stream length the same.  Save the file.
    When the file is opened in Acrobat, the field will appear blank until "Show border hover color for fields" is turned off.
    An example file is here.
    This file has several fields, two which are prefilled.  The first field contains filled in text but does not show (it appears when you turn off "Show border...").  The second is visible.
    By editing the raw data, the second field (object 13 0) can be changed to exhibit both bugs.  To exhibit the BMC bug, insert a second space between /Tx and BMC and remove a space elsewhere.  The exhibit the second bug (after restoring BMC), change both "0 g" and "1 g" with "/DeviceGray cs 1 sc" and "/DeviceGray cs 0 sc" respectively (there is enough blank spaces to do that).

    Bugs must be reported via the official route at http://www.adobe.com/go/wish
    Posts in these forums are not logged and are unlikely to receive any attention.

  • How to keep a border even after right-clicking

    I have a JButton around which I would like:
    1) a raised border to appear when hovering over the button,
    2) a lowered border to appear when left-clicking on the button,
    3) no border to appear when releasing or exiting the button, and
    4) a raised border to appear when right-clicking on the button and bringing up a popup menu.
    I created a MouseListener to achieve effects 1) through 3) above, but I'm having trouble achieving effect 4).
    It appears that showing a popup menu causes my MouseListener's mouseExited() method to be fired. This method, though, is currently only responsible for achieving effect 3).
    Is there a way to make my mouseExited() method smart enough to implement effect 4) instead of 3) if it realizes it has been invoked as a result of a popup menu display? In other words, is there a way to make a border appear around my button even when the user has opened up a popup menu for that button?
    I tried interrogating the value of MouseEvent.isPopupTrigger(), but that always appears to return false in mouseExited() [ it only ever returns true for me in mouseReleased() ].
    Any suggestions would be greatly appreciated.
    Thanks,
    Mike

    Jay,
    Thanks for your reply. Attached is my updated code that includes the popup listening logic. This logic seems to work, except for the following issues:
    1) The button becomes temporarily depressed when right-clicking on it (just as you stated).
    2) If I right click on a Button A to display its popup menu and then move my mouse over to another Button B, Button B becomes raised even though Button A's popup menu hasn't been dealt with yet.
    Regarding issue 1) above, could I test for whether mouse BUTTON_1 or BUTTON_2 was pressed to determine whether the mouse should be depressed, or would this make my logic platform-dependent?
    Regarding issue 2) above, is there a way to block other buttons from appearing raised while a popup menu still appears in support of another button? Or is there just a problem in my implementation of the popup (i.e. it doesn't expire)?
    Thanks,
    Mike
         public class ButtonBorderMouseListener implements MouseListener, PopupMenuListener
              public final Border NO_BORDER = BorderFactory.createEmptyBorder();
              public final Border LOWERED_BEVEL_BORDER = BorderFactory.createLoweredBevelBorder();
              public final Border RAISED_BEVEL_BORDER = BorderFactory.createRaisedBevelBorder();
              private boolean m_buttonPopupIsVisible;
              public ButtonBorderMouseListener()
                   super();
              public synchronized boolean buttonPopupIsVisible()
                   return m_buttonPopupIsVisible;
              public synchronized void setButtonPopupIsVisible(boolean isVisible_)
                   m_buttonPopupIsVisible = isVisible_;
              /* (non-Javadoc)
               * @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent)
              public void mouseClicked(MouseEvent e)
                   System.out.println("Mouse clicked");
                   System.out.println("Is a popup trigger == " + e.isPopupTrigger());
                   JButton sourceBtn = (JButton) e.getComponent();
                   Border borderToApply = ((buttonPopupIsVisible()) ? RAISED_BEVEL_BORDER : LOWERED_BEVEL_BORDER);
                   System.out.println("borderToApply == " + ((borderToApply == RAISED_BEVEL_BORDER) ? "RAISED" : "LOWERED"));
                   sourceBtn.setBorder(borderToApply);
              /* (non-Javadoc)
               * @see java.awt.event.MouseListener#mouseEntered(java.awt.event.MouseEvent)
              public void mouseEntered(MouseEvent e)
                   System.out.println("Mouse entered");
                   JButton sourceBtn = (JButton) e.getComponent();
                   sourceBtn.setBorder(RAISED_BEVEL_BORDER);
                   System.out.println("borderToApply == RAISED");
              /* (non-Javadoc)
               * @see java.awt.event.MouseListener#mouseExited(java.awt.event.MouseEvent)
              public void mouseExited(MouseEvent e)
                   System.out.println("Mouse exited");
                   System.out.println("Is a popup trigger == " + e.isPopupTrigger());
                   JButton sourceBtn = (JButton) e.getComponent();
                   Border borderToApply = ((buttonPopupIsVisible()) ? RAISED_BEVEL_BORDER : NO_BORDER);
                   System.out.println("borderToApply == " + ((borderToApply == RAISED_BEVEL_BORDER) ? "RAISED" : "NONE"));
                   sourceBtn.setBorder(borderToApply);
              /* (non-Javadoc)
               * @see java.awt.event.MouseListener#mousePressed(java.awt.event.MouseEvent)
              public void mousePressed(MouseEvent e)
                   System.out.println("Mouse pressed");
                   System.out.println("Is a popup trigger == " + e.isPopupTrigger());
                   JButton sourceBtn = (JButton) e.getComponent();
                   Border borderToApply = ((e.isPopupTrigger()) ? RAISED_BEVEL_BORDER : LOWERED_BEVEL_BORDER);
                   System.out.println("borderToApply == " + ((borderToApply == RAISED_BEVEL_BORDER) ? "RAISED" : "LOWERED"));
                   sourceBtn.setBorder(borderToApply);
              /* (non-Javadoc)
               * @see java.awt.event.MouseListener#mouseReleased(java.awt.event.MouseEvent)
              public void mouseReleased(MouseEvent e)
                   System.out.println("Mouse released");
                   System.out.println("Is a popup trigger == " + e.isPopupTrigger());
                   JButton sourceBtn = (JButton) e.getComponent();
                   Border borderToApply = ((e.isPopupTrigger()) ? RAISED_BEVEL_BORDER : NO_BORDER);
                   System.out.println("borderToApply == " + ((borderToApply == RAISED_BEVEL_BORDER) ? "RAISED" : "NONE"));
                   sourceBtn.setBorder(borderToApply);
              /* (non-Javadoc)
               * @see javax.swing.event.PopupMenuListener#popupMenuCanceled(javax.swing.event.PopupMenuEvent)
              public void popupMenuCanceled(PopupMenuEvent e)
                   System.out.println("Popup menu cancelled");
              /* (non-Javadoc)
               * @see javax.swing.event.PopupMenuListener#popupMenuWillBecomeInvisible(javax.swing.event.PopupMenuEvent)
              public void popupMenuWillBecomeInvisible(PopupMenuEvent e)
                   System.out.println("Popup menu will become invisible");
                   setButtonPopupIsVisible(false);
                   JPopupMenu popupMenu = (JPopupMenu) e.getSource();
                   JButton sourceBtn = (JButton) popupMenu.getInvoker();
                   System.out.println("borderToApply == NONE");
                   sourceBtn.setBorder(NO_BORDER);    
              /* (non-Javadoc)
               * @see javax.swing.event.PopupMenuListener#popupMenuWillBecomeVisible(javax.swing.event.PopupMenuEvent)
              public void popupMenuWillBecomeVisible(PopupMenuEvent e)
                   System.out.println("Popup menu will become visible");
                    setButtonPopupIsVisible(true);
         }

  • How to add a vertical resize bar for each TableRow in a TableView?

    I am looking for a best approach / best practice to accomplish this task. I need to be able to implement, in the least, re-sizable (by dragging on a divider line) TableRows. I understand this to be a bit more difficult to retain the height of each individual TableRow because they are virtual and reused. My first goal is only to have all TableRows re-sized (eliminating the need to carry individual row sizes ).
    I am able to implement my own TableRow by extending TableRow - and I was able to retrieve a reference to the TableRow's Skin and adding a divider line (Rectangle) and capturing the Mouse events to effectively re-size the height of the Row by dragging.
    My Question is this: Without implementing a new TableRowSkin - how can I force the divider line to be at the bottom of the TableRow? Currently - I am just adding the Rectangle Node (Divider) to the TableRowSkin's children list - causing the divider line to be positioned at the top of the TableRow (This gives an odd feeling when resizing - the line should be on the bottom).
    I feel like I am hacking at the issue without realizing the intent of the JavaFX developers. Is the intent for Row Height resizing to be implemented by providing a new Skin? There doesn't seem to be an easy way to accomplish this task using the existing TableRow or TableRowSkin.
    I can post example code if requested - but I will need to condense the example to a small enough self-contained file.
    If the answer is "Yes - implement a new skin" that is fine, but this task might be difficult without the source code for guidance :) [hint..hint..]

    After attempting to override the TableRow itself - I ran into a bug in the underlying skin causing a ClassCastException when sorting on the headers - apparently the underlying TableRowSkin doesn't like it when you add anything other then a TableCell (I added a Rectangle in this case, could not be cast to a TableCell). The bug was filed in Jira and fixed for 2.1 - so in the mean time I took the individual TableCell approach - add a divider to the bottom of each tableCell.
    The trick is not the the divider - but it is the other Control you have above the divider. I am using a TextArea, and you may generally want to override the PreferredHeight otherwise the height of the Control continues to extend. This behavior may be a result of using VBox to house the TextArea and the Rectangle vs your suggestion of a BorderPane.
    I was able to get the aesthetic functionality working to my desire. NOTE: functionality needs to be added for the table to "remember" any change of tablerowheight for each associated data item - otherwise the TableRow with the differeing height will get recycled and used for a different data item later. This shouldn't be too hard to implement with a Map for every non-default tableRowHeight change with a key of the TableRow Data Item. (Perhaps a max memory of associations as to not use up all available memory if someone wanted to resize all rows, for instance. Or we could also apply a new default Row size as well. I'm thinking this functionality should be applied to a sub-classed TableView).
    editThe posted code does not have a bug - it is placing the vertical resize divider in each cell, not each tablerow. Aesthiticaly - it will take some additional tweaking. You will notice the Textarea scroll bar "bleeds" into the other Transparent cells.. Not a critical bug, but an issue to deal with I will have to tackle later. If I can hack into the TableColumn resizing behavior - or set a minWidth on each Tablecolumn - that will be my approach to deal with it for now.--edit--
    public class TextAreaCell<S> extends TableCell<S,String> {
            private TextArea textArea;
            private StringProperty boundToCurrently = null;
            private Rectangle r = new Rectangle(1,3,Color.TRANSPARENT);
            private VBox vbox = new VBox();
            public TextAreaCell() {
                this.getStyleClass().add("table-cell-for-controls");
                textArea = new TextArea();
                textArea.getStyleClass().add("table-cell-text-field");
                textArea.setWrapText(true);
                textArea.prefHeightProperty().set(5);
                textArea.minHeightProperty().set(0);
                vbox.getChildren().add(textArea);
                vbox.getChildren().add(r);
                vbox.setFillWidth(true);
                r.widthProperty().bind(vbox.widthProperty());
                r.setCursor(Cursor.V_RESIZE);
                r.setOnMouseDragged(new EventHandler<MouseEvent>() {
                    @Override
                    public void handle(MouseEvent event) {
                        TextArea y = TextAreaCell.this.textArea;
                        TextAreaCell.this.printTextAreaInfo(y, event);
                        TableRow tr = TextAreaCell.this.getTableRow();
                        double newHeight = tr.getHeight() + event.getY();
                        if (newHeight <= 24) {
                            newHeight = 24;
                        tr.setPrefHeight(newHeight);
                        tr.requestLayout();
                VBox.setVgrow(textArea, Priority.SOMETIMES);
                vbox.setMinWidth(1);
                this.setGraphic(vbox);
            @Override
            protected void updateItem(String item, boolean empty) {
                super.updateItem(item, empty);           
                if(!empty) {
                    // Show the Text Area
                    this.setContentDisplay(ContentDisplay.GRAPHIC_ONLY);
                    // Retrieve the actual String Property that should be bound to the TextField
                    // If the TextField is currently bound to a different StringProperty
                    // Unbind the old property and rebind to the new one
                    ObservableValue<String> ov = getTableColumn().getCellObservableValue(getIndex());
                    SimpleStringProperty sp = (SimpleStringProperty)ov;
                    if(this.boundToCurrently==null) {
                        this.boundToCurrently = sp;
                        this.textArea.textProperty().bindBidirectional(sp);
                    else {
                        if(this.boundToCurrently != sp) {
                            this.textArea.textProperty().unbindBidirectional(this.boundToCurrently);
                            this.boundToCurrently = sp;
                            this.textArea.textProperty().bindBidirectional(this.boundToCurrently);
                else {
                    this.setContentDisplay(ContentDisplay.TEXT_ONLY);
            private void printTextAreaInfo(TextArea t, MouseEvent e) {
                StringBuilder s = new StringBuilder();
                s.append(e.toString()).append("\n");
                s.append("\tTextArea.prefHeight:").append(t.getPrefHeight()).append("\n");
                s.append("\tTextArea.MinHeight:").append(t.getMinHeight()).append("\n");
                s.append("\tTextArea.MaxHeight:").append(t.getMaxHeight()).append("\n");
                s.append("\tTextArea.Height:").append(t.getHeight()).append("\n");
                s.append("------------------------------------------------------------------------------------------------------------------------");
                System.out.println(s.toString());
    }And the Css
    .table-cell-for-controls {
        -fx-skin: "com.sun.javafx.scene.control.skin.TableCellSkin";
        -fx-padding: 0; /* 2px, plus border adds 1px */
        -fx-background-color: transparent;
        -fx-border-color: -fx-table-cell-border-color -fx-table-cell-border-color -fx-table-cell-border-color -fx-table-cell-border-color;
        -fx-border-width: 0.083333em; /* 1 */
        -fx-cell-size: 2.0em; /* 24 */
    .table-cell-text-field {
        -fx-background-color: transparent;/*-fx-control-inner-background;*/
        -fx-background-insets: 0;
        -fx-background-radius: 0;
        -fx-padding: 3 5 3 5;
        -fx-prompt-text-fill: derive(-fx-control-inner-background,-30%);
        -fx-cursor: text;
    }Edited by: jkaufmann on Nov 7, 2011 4:33 AM

  • [svn:fx-trunk] 10138: Adding alpha to BitmapFill

    Revision: 10138
    Author:   [email protected]
    Date:     2009-09-10 16:51:52 -0700 (Thu, 10 Sep 2009)
    Log Message:
    Adding alpha to BitmapFill
    http://bugs.adobe.com/jira/browse/SDK-22932 - Border's backgroundAlpha style has no effect when backgroundImage is set
    I have added an alpha property to BitmapFill. Since graphics.beginBitmapFill doesn?\226?\128?\153t have an alpha parameter, I have to clone the bitmapData source and apply to it a colorTransform (which contains the alphaMultipler).
    If the source image doesn't support an alpha channel (ex. JPEG), then I need to copy the source into a new bitmapData object that supports transparency. This occurs one time in the source setter.
    If the alpha or source has changed, then I need to copy the source into a new bitmapData. The reason is that using the BitmapData.colorTransform function is cumulative. Once I've applied an alphaMultiplier to it, there is no way to restore the alpha. I've optimized the code a bit to only copy the bitmapData if needed. For example, if we have already copied the data to add the transparent pixel border (to prevent the streaking effect on a non-repeating fill), then we forgo the copying.
    QE notes: Need new tests for this property
    Doc notes: Need docs for this property
    Bugs: SDK-22932
    Reviewer: Ryan
    Tests run: checkintests
    Is noteworthy for integration: Yes
    Ticket Links:
        http://bugs.adobe.com/jira/browse/SDK-22932
        http://bugs.adobe.com/jira/browse/SDK-22932
    Modified Paths:
        flex/sdk/trunk/frameworks/projects/framework/src/mx/graphics/BitmapFill.as
        flex/sdk/trunk/frameworks/projects/spark/src/spark/skins/spark/BorderSkin.as

Maybe you are looking for

  • The version number of export file in Java Card 2.2 is not correct

    Hi all, I used jdk1.3.1 and java card 2.2's exp2text tool to see the content of an export file. The value of minor_version is 1. But the JCVM 2.2 spec. says it should be 2. So which one is correct? Joey

  • Error when using packages

    hi! I am new to java .... learning how to use packages. I have created dir on my harddrive c:\learning\java ... in which i have created com\tests.... added c:\learning\java to path env variable .... And have written two java programs. 1. jmain.java a

  • Return Po with excise invoice ??

    hii I have created return PO with tax code V0.? mean , tax code with duty i have selected in return PO with return indicator tick. Now i m doing MIGO aginst return PO. Its asking for excise invoice number and date . Here which excise invoice number i

  • Change Multiple Choice Options from A, B, C to 1, 2, 3?

    I am using Captivate 8.1. I need to create a multiple-choice quiz where the answer options are 1, 2, and 3 instead of A, B, and C. I can't find a setting anywhere that lets me change the "numbering" (for lack of a better term) format of the multiple-

  • Why does Firefox not include FOX NEWS in their pre-loaded "News" tab on the toolbar???

    There are 9 different "news" sources. It seems that everybody is so biased against Fox News, yet they produce legitimate news as every other network. Please change this, Firefox, for all your users.