Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Java
  4. Java GUI help [modified]

Java GUI help [modified]

Scheduled Pinned Locked Moved Java
javaalgorithmshelptutorialquestion
3 Posts 2 Posters 3 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    BlackWolvix
    wrote on last edited by
    #1

    Hi i have been searching the internet for days and couldn't find the answer .. so please bear with me ;) anyways i have been trying to solve this question .. the question goes as follow: Q: Write a program that fills the component with a large ellipse, filled with your favorite color that touches the window boundaries. The ellipse should resize itself when you resize the window. Guys all i wanna know is how to make it touch the boundaries and how to make it resize itself. Thank you.

    modified on Tuesday, July 22, 2008 3:46 PM

    T 1 Reply Last reply
    0
    • B BlackWolvix

      Hi i have been searching the internet for days and couldn't find the answer .. so please bear with me ;) anyways i have been trying to solve this question .. the question goes as follow: Q: Write a program that fills the component with a large ellipse, filled with your favorite color that touches the window boundaries. The ellipse should resize itself when you resize the window. Guys all i wanna know is how to make it touch the boundaries and how to make it resize itself. Thank you.

      modified on Tuesday, July 22, 2008 3:46 PM

      T Offline
      T Offline
      toxcct
      wrote on last edited by
      #2

      how to make it touch the window ? easy :) draw it of the size of the component, and be sure the component is of the size of the window (in your window, add a panel, on which you can draw directly)... if you place the drawing code in the correct event handler, (overload paintComponent(Graphics)).

      [VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]

      B 1 Reply Last reply
      0
      • T toxcct

        how to make it touch the window ? easy :) draw it of the size of the component, and be sure the component is of the size of the window (in your window, add a panel, on which you can draw directly)... if you place the drawing code in the correct event handler, (overload paintComponent(Graphics)).

        [VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]

        B Offline
        B Offline
        BlackWolvix
        wrote on last edited by
        #3

        thanx but i figured it out alrdy :) ... i really apprecite ur help ;) but here what i got recently ... i extracted it from netbeans XD this is an example using button instead of ellipse ;)

        jButton1 = new javax.swing.JButton();

            setDefaultCloseOperation(javax.swing.WindowConstants.EXIT\_ON\_CLOSE);
        
            jButton1.setText("jButton1");
            jButton1.setMaximumSize(new java.awt.Dimension(73, 23));
            jButton1.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jButton1ActionPerformed(evt);
                }
            });
        
            javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
            getContentPane().setLayout(layout);
            layout.setHorizontalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(jButton1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT\_SIZE, 400, Short.MAX\_VALUE)
            );
            layout.setVerticalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(jButton1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT\_SIZE, 300, Short.MAX\_VALUE)
            );
        

        there u go i hope u also benefited ;)

        BlaCk WolViX

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups