jframe

Setting a JFrame without overlapping with taskbar

我的未来我决定 提交于 2019-12-02 00:10:27
问题 I need to have a undecorated JFrame( setUndecorated(true) ) which need to be shown fullscreen, without overlapping with the taskbar. I have tried the below solutions. Calling setExtendedState(MAXIMIZED_BOTH). Advantage : This works fine as expected, i.e., the window is getting adjusted itself dynamically, except it has the below issues. Issues Initially the window occupies the fullscreen Though the frame get adjusted itself dynamically, it overlaps with the taskbar. Tried the below solution

Do I actually call the paintComponent method I make when creating a rectangle in Java?

孤人 提交于 2019-12-02 00:04:11
问题 This is my current RectangleComponent class and I add it to a panel in my main JFrame but it never appears. I thought it wasn't drawing so I decided to call the paintComponent method in the Rectangle's constructor, and after sorting through 4-5 nullPointerExceptions, nothing has changed. I've read multiple guides on how to draw rectangles and I have seen multiple code examples, but I can never get the panels to work with more than one JComponent. If you could, please take a brief look at my

Get Pixel Color on screen Java?

允我心安 提交于 2019-12-01 23:50:24
Hello I am trying to get the color of a particular pixel on my JFrame. This is my code. My frame is red. The problem I am having is when I click the Frame it should return me the RGB color for red that is (255,0,0) but when I click at different points i sometimes get the RGB color for white (255,255,255) what is the problem in my code guys? public class guiTest extends JFrame { private static Shape ellipse; private static Robot rb; public guiTest() { super("4-connected approach"); setLayout(new FlowLayout()); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setVisible(true); setSize(800,800);

Reading all new messages from my gmail using javamail

随声附和 提交于 2019-12-01 23:22:50
I have an application which contains a GUI, it is using Javamail. When i open this Jframe I have to see messages that are sent to my mail on a jTextArea . The problem is when i wrote my code it only shows just the last message sent. How do I display all new messages in my inbox? This is my code : private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { Properties props = new Properties(); props.put("mail.pop3.host", "pop.gmail.com"); props.put("mail.pop3.user", "mymail@gmail.com"); props.put("mail.pop3.socketFactory", 995); props.put("mail.pop3.socketFactory.class", "javax.net

How can I replace one of two JPanels with another JPanel in Java?

邮差的信 提交于 2019-12-01 23:09:56
I designed an interface for the welcome screen with one JFrame included two JPanels (JPanel1 on right and JPanel2 on left). The buttons on the left is to switch the Panels in JPanel1. I want to press on a button to replace JPanel1 content with another JPanel but I don`t know how. Please help. Here is a very simple example of something that should approximate your description. On the left, we have a hug button to toggle the content of the right panel. On the right, you have a panel with a given border and a label. When you press the button, the content on the right is swapped with the other

Java: how to register a listener that listen to a JFrame movement

狂风中的少年 提交于 2019-12-01 22:36:37
How can you track the movement of a JFrame itself? I'd like to register a listener that would be called back every single time JFrame.getLocation() is going to return a new value. EDIT Here's a code showing that the accepted answered is solving my problem: import javax.swing.*; public class SO { public static void main( String[] args ) throws Exception { SwingUtilities.invokeAndWait( new Runnable() { public void run() { final JFrame jf = new JFrame(); final JPanel jp = new JPanel(); final JLabel jl = new JLabel(); updateText( jf, jl ); jp.add( jl ); jf.add( jp ); jf.pack(); jf.setVisible( true

Image not at proper place after rotating (graphics)

 ̄綄美尐妖づ 提交于 2019-12-01 22:28:24
I am trying to display two rotating wheels with diameter 512untis at different rates but i am not able to remove the previous drawn image graphics and set the rotated graphics at the correct position. For now i am doing a rotation with arbitrary angle. I tried affineTransform and got the rotations but it was weird like all pixels spread away. Im using a while loop with thread.sleep(). The following is the code : //The drawSmallCircle and drawBigCircle return two images. class MyFramePart2 extends JFrame { String name; JPanel big_obj_panel,small_obj_panel; JLabel bigLabel,smallLabel

How to add jlabel image hovering?

﹥>﹥吖頭↗ 提交于 2019-12-01 22:21:02
How would I go upon adding JLabel hovering? Like when you move your mouse over top a JLabel a and new image will overlap it. I know how to make it work with buttons, but the same technique will not work for JLabel s. Will anyone guide me towards adding JLabel hovering? Please and thanks. package src; import java.awt.Dimension; import javax.swing.ImageIcon; import javax.swing.JFrame; import javax.swing.JLabel; /* * @Author - 0x29A * * */ public class Jframe { public static void main(final String args[]) { /* * @Images */ final ImageIcon icon = new ImageIcon("Data/button.png"); final JLabel

Do I actually call the paintComponent method I make when creating a rectangle in Java?

橙三吉。 提交于 2019-12-01 21:39:37
This is my current RectangleComponent class and I add it to a panel in my main JFrame but it never appears. I thought it wasn't drawing so I decided to call the paintComponent method in the Rectangle's constructor, and after sorting through 4-5 nullPointerExceptions, nothing has changed. I've read multiple guides on how to draw rectangles and I have seen multiple code examples, but I can never get the panels to work with more than one JComponent. If you could, please take a brief look at my code and see if you can devise a solution. Thank you for your time. Also listed is the Frame I call the

Setting a JFrame without overlapping with taskbar

╄→尐↘猪︶ㄣ 提交于 2019-12-01 21:34:51
I need to have a undecorated JFrame( setUndecorated(true) ) which need to be shown fullscreen, without overlapping with the taskbar. I have tried the below solutions. Calling setExtendedState(MAXIMIZED_BOTH). Advantage : This works fine as expected, i.e., the window is getting adjusted itself dynamically, except it has the below issues. Issues Initially the window occupies the fullscreen Though the frame get adjusted itself dynamically, it overlaps with the taskbar. Tried the below solution as stated in Does JFrame.setExtendedState(MAXIMIZED_BOTH) work with undecorated frames?