jviewport

Temporarily disable or prevent repainting JViewPort on scrolling with a mouseDrag

与世无争的帅哥 提交于 2019-11-29 12:21:31
I have written a MouseListener as defined below so that I can move a JButton around to reorder the components that are within the JPanel . The JPanel is within a JScrollPane so that when multiple components are added they can be scrolled. The problem I have is that when dragging the component and the mouse goes out of the scrollpane/viewport then the component will snap back to its position within the JPanel then will be drawn in the correct location. I assume that this behavior is due to the Viewport calling a repaint of its children when I call scrollRectToVisible() Is there a way that I can

Moving a view port over a larger image; JLablel+JScrollPane

旧街凉风 提交于 2019-11-28 09:57:10
问题 I have a JScrollPane m_jScrollPane with a JLabel m_jlImage being displayed inside of it. The m_jlImage is a screen capture with a red dot drawn where the user last clicked on the screen. I wish to move (read scroll) the viewing area of the m_jScrollPane over the red dot on the m_jlImage . lastClick is the last place the user clicked and is in the same coordinates as m_jlImage . This is proving to be more difficult that I thought. I decided to get the ratio of the click point's value to the

Temporarily disable or prevent repainting JViewPort on scrolling with a mouseDrag

我的梦境 提交于 2019-11-28 05:52:58
问题 I have written a MouseListener as defined below so that I can move a JButton around to reorder the components that are within the JPanel . The JPanel is within a JScrollPane so that when multiple components are added they can be scrolled. The problem I have is that when dragging the component and the mouse goes out of the scrollpane/viewport then the component will snap back to its position within the JPanel then will be drawn in the correct location. I assume that this behavior is due to the

How to put a component on top of others?

匆匆过客 提交于 2019-11-27 09:47:51
I have a JScrollPanel that includes a big panel which it's self includes 3 inner panels. i want to put a panel (for example) in a special place so that always could be seen, I mean the user can scroll to anywhere wants but that panel always is in top of the other components and doesn't move. I tried to do that via JLayeredPane but I couldn't. how may I do that? trashgod There's a JLayeredPane example here , but OverlayLayout , seen here , may be of interest. It's not included in the conventional gallery . Also consider this example that paints on the scroll pane's JViewport . You could use The

How to put a component on top of others?

谁都会走 提交于 2019-11-27 04:01:22
问题 I have a JScrollPanel that includes a big panel which it's self includes 3 inner panels. i want to put a panel (for example) in a special place so that always could be seen, I mean the user can scroll to anywhere wants but that panel always is in top of the other components and doesn't move. I tried to do that via JLayeredPane but I couldn't. how may I do that? 回答1: There's a JLayeredPane example here, but OverlayLayout , seen here, may be of interest. It's not included in the conventional

JTable how to change BackGround Color

时光怂恿深爱的人放手 提交于 2019-11-26 15:30:11
I inspired by MeBigFatGuy interesting question , in this conection I have very specific question about Graphisc2D , how to change BackGround Color by depends if is JTables Row visible in the JViewPort , 1) if 1st. & last JTables Row will be visible in the JViewPort , then BackGround would be colored to the Color.red 2) if 1st. & last JTables Row will not be visible in the JViewPort , then BackGround would be colored to the Color.whatever from SSCCE import java.awt.*; import java.awt.event.ActionEvent; import java.awt.image.BufferedImage; import javax.swing.*; import javax.swing.RepaintManager;

Passing current Date

做~自己de王妃 提交于 2019-11-25 23:32:02
问题 Seems like as not possible to fix Graphics2D lack in code, there I must to set fix size for animations, otherwise some Start outside Rectangle 490 x 490 freeze or shaking on the screen my SSCCE import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.image.BufferedImage; import java.util.ArrayList; import java.util.Random; import java.util.Vector; import java.util.regex.Pattern; import javax.swing.*; import javax.swing.table.*; public class