[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Java clear part canvas

Posted on 2010-09-15
5
Medium Priority
?
782 Views
Last Modified: 2013-11-23
Hi all

I'm new to Java and learning

If I was to clear the canvas I would use removeAll()

how can I remove objects only from the bottom half of my canvas and specify the x y of what part I want to clear

Thanks
0
Comment
Question by:markavo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 26

Expert Comment

by:ksivananth
ID: 33689034
you need to provide the impl,

1. travese all the components in the canvas
2. compare the co-ordiante of the components in the canvas against your x, y
3. if it is after that, remove that component
0
 
LVL 37

Expert Comment

by:zzynx
ID: 33689208
>> specify the x y of what part I want to clear
Why would you want to do that?

When I read this, I think you're working a bit unusual.
That's why I ask you the previous question.

If I know what components I need to remove at some point in time, I would keep references to them.
Then to remove them I can simply call

remove( getMyComponent1() );
remove( getMyComponent2() );
...
remove( getMyComponentN() );
0
 

Author Comment

by:markavo
ID: 33695631
Hi

Thank you , can you give me an example please how i would reference for example

GRect rect = new GRect (x,y, height, width) ;
add(rect);

so rect holds a new Grect

this would remove the object ---- remove(rect);

How would i pass the reference through to methods so i can remove objects from within a method and call remove(rect)

help appreciated
0
 
LVL 37

Accepted Solution

by:
zzynx earned 1000 total points
ID: 33699111
>> How would i pass the reference through to methods so i can remove objects from within a method and call remove(rect)

GRect rect = new GRect (x,y, height, width) ;
add(rect);

....

yourMethod1(rect);
...
yourMethod2(rect);

with

private yourMethod1(GRect rect) {
   ....
   remove(rect);
   ....
}

and

private yourMethod2(GRect rect) {
   ....
   remove(rect);
   ....
}
0
 
LVL 37

Expert Comment

by:zzynx
ID: 33723881
Thanx 4 axxepting
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
Suggested Courses

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question