Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6786325
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T17:13:55+00:00 2026-05-26T17:13:55+00:00

I am making a free cross platform mock up designer in Java. I have

  • 0

I am making a free cross platform mock up designer in Java. I have designed the UI & was able to add components(selected by user) on a Panel.Now I wish to do following things-

1.make the added components re-sizable while the app is running.I mean I want to show a double head arrow when the mouse pointer is at border of that component so that user starts drag the mouse pointer & its size increases or decreases.

2.enable smooth move of components inside the panel while dragged.(by this time it seems frustrating because it blinks(flickers) while moving & place it self in another position rather than mouse pointer hotspot!)

3.Some components(during adding to panel by selecting that component from component pane then clicking on the panel) are placed a bit far from expected point(hotspot).
Here’s the code for drag:

public void dragControl(MouseEvent evt)
{
    JComponent jc=(JComponent)evt.getSource();
    if((evt.getX()<drawingPane.getWidth()-64)&&(evt.getY()<drawingPane.getHeight()-32))
        {
            jc.setLocation(evt.getX(),evt.getY());
            drawingPane.validate();

        }

} 

and here’s one that for adding the component in panel.(drawingpane)

private void finalizeControlAddition(JComponent c,JComponent cont,MouseEvent evt,int width,int height)
{
    if((evt.getX()<drawingPane.getWidth()-width)&&(evt.getY()<drawingPane.getHeight()-height))
                    addComponent(cont,c,evt.getX(),evt.getY(),width,height);
                //
                c.setName(Integer.toString(counter));//save a tag of its identification
                //
                components.add(counter, c);
                counter++;
                //
                selectedControl=-1;
                //
                cont.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
                //
                statusLabel.setText("Control added.Drag to give proper position or select to change properties from Properties pane.");
}
private void addComponent(Container container,Component c,int x,int y,int width,int height)
{
      c.setBounds(x,y,width,height);
  container.add(c);
      c.repaint();
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T17:13:55+00:00Added an answer on May 26, 2026 at 5:13 pm

    After trying hard I have solved these problems. As these are very common problems that anyone may face, I have created a open library for doing all these tasks which you can use in your app. It can be found here:

    http://sourceforge.net/p/actioncomponent/home/Home

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I will be making a cross-platform, graphical mathematical modeling application, for example, a user
I have a website made to provide free web-based tools for making indie games.
I'm making a paid/free version of my app so have a 'Library Project' that
What are best solutions for making user formatted input safe + script/flash free XHTML
I'm planning on making some dynamic PHP websites and I need a free Authentication
Making my first steps with NHibernate, I'm trying to have it creating my Tables
I'm making a game in Java, and I need a good file format to
I am making a gallery implementation for PHP. The administrator is able to access
I'm making a C# image gallery for a website (I know there's many free
I have two free apps, iSys and iSysMonitor, that report info about my iPhone.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.