glasspane

Block entire swing ui except for one component - “dialog style”

╄→гoц情女王★ 提交于 2019-12-02 07:07:31
[This question is in relation to this question ] Setting : I have this home-crafted "editable label" component which looks like a label, but when you click it, it turns into an editable field, allowing you to edit it. You can hit Esc to cancel, or Shift-Enter to OK your edits - or click the respective buttons beneath the editable field. The challenge : When you go into this edit-mode, I want the rest of the UI to be completely blocked: You shall either cancel or OK the edit before being able to do anything else. While writing this, I realize the obvious: This is exactly how a dialog operates -

Block entire swing ui except for one component - “dialog style”

房东的猫 提交于 2019-12-02 06:58:48
问题 [This question is in relation to this question] Setting : I have this home-crafted "editable label" component which looks like a label, but when you click it, it turns into an editable field, allowing you to edit it. You can hit Esc to cancel, or Shift-Enter to OK your edits - or click the respective buttons beneath the editable field. The challenge : When you go into this edit-mode, I want the rest of the UI to be completely blocked: You shall either cancel or OK the edit before being able

For glasspane purposes, why are input elements in Swing seemingly not considered part of a JPanel?

余生长醉 提交于 2019-12-02 02:44:43
问题 By input elements I mean things like JSpinners and JComboxBoxes. My glasspane is passed a JPanel containing JSpinners, JComboBoxes and for the most part, JLabels. The glasspane has a MouseListener attached. The surprising thing is that mouseEntered is called upon the mouse cursor leaving the input elements and hovering over the other parts or empty space of the JPanel! Is this normal behaviour? How can I get the input elements to be considered part of the JPanel for Glasspane purposes? Here

For glasspane purposes, why are input elements in Swing seemingly not considered part of a JPanel?

纵饮孤独 提交于 2019-12-02 02:38:10
By input elements I mean things like JSpinners and JComboxBoxes. My glasspane is passed a JPanel containing JSpinners, JComboBoxes and for the most part, JLabels. The glasspane has a MouseListener attached. The surprising thing is that mouseEntered is called upon the mouse cursor leaving the input elements and hovering over the other parts or empty space of the JPanel! Is this normal behaviour? How can I get the input elements to be considered part of the JPanel for Glasspane purposes? Here is a screenshot of my UI with its input elements and jLabels. Here is an example piece of Code: import

Layout Manager and Positioning

你说的曾经没有我的故事 提交于 2019-12-01 17:34:55
how to stick JLabel in GlassPane to rellative, floating coordinates from JProgressBar without using ComponentListener or another listener, is there built_in notifiers in Standard LayoutManagers that can notify about its internal state, and can be accesible for override, instead my attempt with ComponentListener and NullLayout . SSCCE about ComponentListener and with NullLayout import java.awt.Container; import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.GridBagConstraints; import java.awt.event.ComponentAdapter; import java.awt.event.ComponentEvent; import javax.swing

X11/Xlib: Create “GlassPane”-Window

烈酒焚心 提交于 2019-11-30 10:11:01
I've tried to create a fully transparent window using C++ & X11. It should not consume any events and simply forwards them to the windows below. Some kind of GlassPane as it's known for Java-Windows, but full screen. Then I'd like to draw on this window. Is this somehow possible with X11? My first attempt was ignoring all events, simply copy the image from the root window using XGetImage() ... But first of all, this is quite slow as the window would need to be full screen. XShmGetImage unfortunately isn't an option here. For sure, this window wouldn't need any decoration, but that isn't a big

X11/Xlib: Create “GlassPane”-Window

喜夏-厌秋 提交于 2019-11-29 15:06:03
问题 I've tried to create a fully transparent window using C++ & X11. It should not consume any events and simply forwards them to the windows below. Some kind of GlassPane as it's known for Java-Windows, but full screen. Then I'd like to draw on this window. Is this somehow possible with X11? My first attempt was ignoring all events, simply copy the image from the root window using XGetImage() ... But first of all, this is quite slow as the window would need to be full screen. XShmGetImage

Inner-Transparent Selection Window in Java using GlassPane

这一生的挚爱 提交于 2019-11-29 14:42:27
I am trying to achieve the following http://www.qksnap.com/i/3hunq/4ld0v/screenshot.png I am currently able to draw rectangles successfully on a semi-transparent glasspane background using the following code: protected void paintComponent(Graphics g) { Graphics2D g2 = (Graphics2D) g; g.setColor(Color.black); // black background g.fillRect(0, 0, frame.getWidth(), frame.getHeight()); g2.setColor(Color.GREEN.darker()); if (getRect() != null && isDrawing()) { g2.draw(getRect()); // draw our rectangle (simple Rectangle class) } g2.dispose(); } Which works great, however, I would love to have the

Inner-Transparent Selection Window in Java using GlassPane

妖精的绣舞 提交于 2019-11-28 08:57:19
问题 I am trying to achieve the following http://www.qksnap.com/i/3hunq/4ld0v/screenshot.png I am currently able to draw rectangles successfully on a semi-transparent glasspane background using the following code: protected void paintComponent(Graphics g) { Graphics2D g2 = (Graphics2D) g; g.setColor(Color.black); // black background g.fillRect(0, 0, frame.getWidth(), frame.getHeight()); g2.setColor(Color.GREEN.darker()); if (getRect() != null && isDrawing()) { g2.draw(getRect()); // draw our

Calculator application including keyboard input in java swing

走远了吗. 提交于 2019-11-28 02:03:46
I have a calculator application in java swing, which is working properly with mouse click input. Now I want it to read input using keyboard button stroke. I had heard about the glass pane in java tutorial, but i need to know any other simple method to meet the requirement. KeyPadPanel is an example that uses Action and Key Bindings for numeric entry. 来源: https://stackoverflow.com/questions/10099686/calculator-application-including-keyboard-input-in-java-swing