Position of enclose component
Hi!
1.Frame
2. panel is enclose in Frame
3. panel2 is enclose in panel
4.panel3 is enclose in panel2
How I can get position of a panel3 concerning the Frame?
Thank you.
I find answer!
Use SwingUtilities.convertPoint(source_component, point, destination_component)
Similar Messages
-
How to fix the position of different component?
Hay all,
Can anybody tell how to fix the position of any component so that they cant be moved from there initial positiion
Regards,
Sharad AgarwalSet layout to null and set bounds of the component to whatever you like.
-
Get layout-position of a component
Hi!
i have a frame applcation with two toolbars.
they can both be dragged to a new position in the borderlayout with the mouse. it was'nt easy to have no problems with the layout-manager when they are set to a new position.
now i want so save the alignment of the toolbars for the next start of the application.
how do i get the current alignment of a toolbar?
the toolbar is an attribute of the class, i know the panel, and that is no other component in the north, south, east or west.
for example the best thing would be to retrieve
String layoutPosition = toolbarPanel.whereTheHellIsTheToolbar(toolbar);
(e.g. "BorderLayout.SOUTH")
to serialize this string and to initialize at the next start
add(toolbar, layoutPosition);
thanks for any help in advance.
RainerNot sure, but this thread might help:
http://forum.java.sun.com/thread.jsp?forum=57&thread=340326 -
Fixing the position of TitleWindow component.
Hello,
I am trying to create an application which has different pages using Flex. Each page is a Flex Title window.
When I click on an icon in the main application window, another page should open (which is actually a title window).
I am trying to fix the position of title window from moving. I should not be able to drag title window in the browser.
I am trying to find a way but was failing each time
Can you please help me in resolving this problem?
Thank you for your cooperation.
Cheers,
KKTry using a Panel component instead of TitleWindow.
HTH,
Kenny Yates -
Get the position of the component on GUI ???
Hi All,
How can I get the position (x, y) of a component such as JCompoBox on Frame at runtime ?
Thanks a lot,
HuyTo the the location of a JComponent in it's parent... just use the getLocation method on the JComponent.
If you need that point relative to some other ancestor, I would use SwingUtilities.convertPoint
Hope this helps,
Josh Castagno
http://www.jdc-software.com -
Rotate position of JProgressBar component
Dear All,
I am new in javafx for animation. I am using JProgressBar component for describe the progress, but I want to rotate the bar to the vertical position thus the progress flow from bottom to up ( not left to right or it reverse). Any suggestion for me, please?
endangJProgressBar? You can set the orientation in the constructor, no?
Otherwise, with JavaFX 1.2, you can just use ProgressBar and rotate it:
def BASE_SIZE = 400;
var n: Number = 0;
var progress: ProgressBar = ProgressBar
progress: bind ProgressBar.computeProgress(100, n)
transforms: Rotate { angle: -90 }
n = 0;
Stage
title: "Native JavaFX Controls"
scene: Scene
width: BASE_SIZE
height: BASE_SIZE
fill: Color.web('#00BABE')
content:
Group
translateX: 200
translateY: 200
content:
progress
var t = Timeline
keyFrames:
KeyFrame { time: 5s, values: n => 100 }
t.play(); -
Getting the position of a component in a container for repainting
This may be a stupid question but, I want to get the position of a custom component as it lays in a JFrame. This is needed for a repaint of the special component. getX() and getY() return the origin of the component as it is painted in paintComponent(). How might this be done without messy parameters to an overridden repaint method?
I need the position so that I can cut out a portion of an underlying background image in the JFrame, so that I can repaint the component's text without clearing away the image or painting over it with a color. If anyone has a better idea, I'm all ears. . .
Thanks.as a near solution to my problem, I have created the following method to locate the exact origin of the custom component:
private int[] getAbsolutePosition(Component c)
int pos[] = {this.getX(), this.getY()};
int x = 0;
int y = 0;
Container parent = c.getParent();
while (parent != null)
x = parent.getX();
pos[0] += x; // append next width
y = parent.getY();
pos[1] += y; // append next height
parent = parent.getParent();
pos[0] -= x; // Remove the position of the parent frame
pos[1] -= y; // from the totals.
return pos;
}The custom component has 3 JPanels, one Container, and a JFrame beneath it. I remove the JFrame positions becuase they would mess things up. Still, the x values it returns are off by a small but noticible amount. Does anyone know what might account for this? -
Relative positioning of JSF component
Hi,
How can I place a JSF component relative to another component, say I want to place a table below another table whose number of rows may vary.
Thanks,
BobHave two differnt tables or use frames and place the controls(tableand button in this case) in different frames.
<table width="100%" height="350"> -outertable
<table .................................................><tr> any number of rows. </tr>-inner table
</table>- - close outer
</tr </table> - close inner
<table> -new table
command button
</table> - close new table -
How to set the extra component to horizontal scrollbar position
How to set the component to position of horizontal scrollbar , that position contain two component horizontal scrollbar and any component (JButton , JLabel ) like that.. Ms-Word scrollbar ,
Like that bellow fig.
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]--><!--[if gte mso 9]><xml>
<w:WordDocument>
<w:View>Normal</w:View>
<w:Zoom>0</w:Zoom>
<w:PunctuationKerning/>
<w:ValidateAgainstSchemas/>
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
<w:DontGrowAutofit/>
</w:Compatibility>
<w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
</w:WordDocument>
</xml><![endif]--><!--[if gte mso 9]><xml>
<w:LatentStyles DefLockedState="false" LatentStyleCount="156">
</w:LatentStyles>
</xml><![endif]-->
<!--
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{mso-style-parent:"";
margin:0in;
margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:"Times New Roman";
mso-fareast-font-family:"Times New Roman";}
@page Section1
{size:8.5in 11.0in;
margin:1.0in 1.25in 1.0in 1.25in;
mso-header-margin:.5in;
mso-footer-margin:.5in;
mso-paper-source:0;}
div.Section1
{page:Section1;}
-->
<!--[if gte mso 10]>
<style>
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:"Table Normal";
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-parent:"";
mso-padding-alt:0in 5.4pt 0in 5.4pt;
mso-para-margin:0in;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:10.0pt;
font-family:"Times New Roman";
mso-ansi-language:#0400;
mso-fareast-language:#0400;
mso-bidi-language:#0400;}
</style>
<![endif]-->{font:'Times New Roman'}{size:12pt}<!--[if gte vml 1]><v:shapetype id="_x0000_t75"
coordsize="21600,21600" o:spt="75" o:preferrelative="t" path="m@4@5l@4@11@9@11@9@5xe"
filled="f" stroked="f">
<v:stroke joinstyle="miter"/>
<v:formulas>
<v:f eqn="if lineDrawn pixelLineWidth 0"/>
<v:f eqn="sum @0 1 0"/>
<v:f eqn="sum 0 0 @1"/>
<v:f eqn="prod @2 1 2"/>
<v:f eqn="prod @3 21600 pixelWidth"/>
<v:f eqn="prod @3 21600 pixelHeight"/>
<v:f eqn="sum @0 0 1"/>
<v:f eqn="prod @6 1 2"/>
<v:f eqn="prod @7 21600 pixelWidth"/>
<v:f eqn="sum @8 21600 0"/>
<v:f eqn="prod @7 21600 pixelHeight"/>
<v:f eqn="sum @10 21600 0"/>
</v:formulas>
<v:path o:extrusionok="f" gradientshapeok="t" o:connecttype="rect"/>
<o:lock v:ext="edit" aspectratio="t"/>
</v:shapetype><v:shape id="_x0000_i1025" type="#_x0000_t75" style='width:453pt;
height:26.25pt'>
<v:imagedata src="file:///C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\msohtml1\04\clip_image001.png"
o:title=""/>
</v:shape><![endif]--><!--[if !vml]--><img src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/04/clip_image002.jpg" alt="" width="485" height="27" /><!--[endif]-->{size}{font}
How to design ?pradeep.rajadurai wrote:
I want set the JTable as a background of jframe or jinternalframe , how it is possible One way that may work, you can always extract the image from a rendered JTable and then paint the same image into the JPanel that holds your components via it's paintComponent method, then added the JPanel to the app's contentPane.
give me simple pgmIs English your second language? Because if so, please understand that this demand can be taken by some as rude. -
Absolute Position of Component
hi!
i'm currently creating a formvalidator.
is a field-validation failed, the validator paints a small red dot on the glasspane over the lower left corner of the field/component.
my problem now is the following:
is the component i want to validate in a container, the getLocation()-method of the component does not give me the absolute position of the component... so my red dot is painted on the false position.
does anybody know how i could get the absolute position of my component? (absolute; relative to my topcontainter, the JFrame or the JDialog)
thx a lot!
greetz
swissManuHi,
have a look here :
http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/SwingUtilities.html#convertPoint(java.awt.Component,%20int,%20int,%20java.awt.Component)
it should permit you converting coordinates relatively to anything ;-)
Nico -
Can I change the Default Position of a JColorChooser Dialog Box???
I am working on a drawing application where I am using a button that launches a JColorChooser dialog to allow a user to select a color which. I have tied this button to the JColorChooser using the source code below to reset the color based on the user's selection. This all works fine. However, when the JColorChooser comes up, the dialog comes up right in the middle of the drawing area and erases any portion of the drawing that the dialog box overlaps with, which having my luck is more or less right in the middle of the JPanel where I am doing the drawing. My question is can I tell the JColorChooser to come up somewhere else in the user interface by offsetting it from the actual application somehow? I am using a JFrame to add all of these components to (the color choose button and the drawing area) and wonder if there is a way to tell the JColorChooser dialog not to come in the default location. Any help that anybody could provide would be greatly appreciated. Thanks!
Kevin
pickColor = new JButton( "Choose Color" );
pickColor.addActionListener(
new ActionListener() {
public void actionPerformed(ActionEvent event)
color = JColorChooser.showDialog(
ColorPicker.this, "Choose a color", color);
if ( color == null )
currentColor = Color.RED;
else
currentColor = color;
);JColorChooser has a method createDialog() that lets you create (rather than
merely show) a dialog containing your colour chooser.
If you use this method you can position the dialog wherever you want. The
dialog inherits the Window methods for positioning - eg
setLocationRelativeTo(Component c). -
Positional Dependencies in Variant Configuration
Hi all,
Is it possible to implement positional dependencies in Variant Configuration?
We want to design the configurable material (e.g: Rack) by deciding where and how many of the components go into creating the rack.
We have to implement dependencies which restrict the position where the component can be placed in the rack and depending on where the component is placed, modify the length of a different component.
Thank you for your helpHi Nirmal,
In your case , Position of component is Variant, so create "Component _Position" as one Characteristics and assign the value (For Ex top, middle bottom).
create Dependencies formula for selection condition at Component assigned in super BOM. Based on the char - position value, component will be selected.
Regards
Pradeep -
Text on top of an image in a component
How do I get text on top of an image in a component?
ImageIcon icon = new ImageIcon("foo.jpg");
JLabel label = new JLabel();
label.setIcon(icon);
// this prints next to, not on top of, the image
label.setText("Hello"); if I add this:
label.setHorizontalAlignment(SwingConstants.CENTER);
label.setVerticalAlignment(SwingConstants.CENTER);The text doesn't appear at all. I assume it is "underneath" the image.
nullif I add this:
label.setHorizontalAlignment(SwingConstants.CENTER);
label.setVerticalAlignment(SwingConstants.CENTER);The alignment methods determine the position of the component in the parent container, if the layout manager respects those values.
I believe you want:
JLabel label = new JLabel("Some Centered Text");
label.setIcon( new ImageIcon("???.jpg") );
label.setHorizontalTextPosition(JLabel.CENTER);
label.setVerticalTextPosition(JLabel.CENTER); -
Using mouse to position iframes, flash components?
I am new to website designing and I used to use Frontpage...
In front page I used to be able to create a blank Iframe and drag a
flash component into that Iframe and then drag and drop it
(position it) wherever I'd like.
In dreamweaver I can't drag and drop. It seems as if it is
locked in position for some reason. Is there a way where I can just
absolutely position the flash component wherever I'd like by
dragging and dropping it with the mouse? Any help would be
appreciated it.If you are coming into DW from FP you need to know this:
without learning
some HTML and CSS, DW will be a very tough experience for
you. And
definitely know that DW is not designed to be freindly to the
drag and drop
crowd. Are you sure it's the right application for you?
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.projectseven.com/go
- DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs,
Tutorials & Resources
==================
"alee12321" <[email protected]> wrote in
message
news:gddt0m$4fj$[email protected]..
>I am new to website designing and I used to use
Frontpage... In front page
>I
> used to be able to create a blank Iframe and drag a
flash component into
> that
> Iframe and then drag and drop it (position it) wherever
I'd like.
>
> In dreamweaver I can't drag and drop. It seems as if it
is locked in
> position
> for some reason. Is there a way where I can just
absolutely position the
> flash
> component wherever I'd like by dragging and dropping it
with the mouse?
> Any
> help would be appreciated it.
> -
I am writing a custom Component inheriting from JComponent class. I am doing custom painting of this component as the component I want has to have a gradient background. I am able to draw the graphics properly. But I am having a problem with the positioning of the control. I read in the tutorial for the custom painting of JComponent that we should paint the component taking the base as 0. If I place my component any where on the panel other than (0,0) the component either gets displayed at 0,0 or is not getting displayed properly.Kindly provide me with a solution.
Painting of the component and positioning of the component are two different things.
Yes painting is done relative to the top left of the component which is (0, 0);
Positioning of the component in a container is done by the Layout Manager. So you need to provide a getPreferredSize(...) implementation so the LayoutManager knows how much space to reserve for the component.
Maybe the Swing tutorial on [url http://java.sun.com/docs/books/tutorial/uiswing/14painting/index.html]Custom Painting will help you out. There is also a section on "Using Layout Manager".
If you need further help then you need to create a [url http://homepage1.nifty.com/algafield/sscce.html]Short, Self Contained, Compilable and Executable, Example Program that demonstrates the incorrect behaviour, because I can't guess exactly what you are doing based on the information provided.
And don't forget to use the [url http://forum.java.sun.com/help.jspa?sec=formatting]Code Formatting Tags so the code retains its original formatting.
Maybe you are looking for
-
Is it possible to upgrade to usb2.0 on my old nx9005 so i can run a mobile broadband dongle
i have an old compaq nx9005 laptop and would like to run a mobile broadband dongle. is it possible to upgrade to usb2.0? i,m running windows xp and have service pack 2. many thanks twidge57 This question was solved. View Solution.
-
Get '500 Internal Server Error' during SIP INVITE - cause 44
/* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-qformat:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in
-
I have taken the next courses and I have the certification Oracle Certified Associate - Oracle 10g SQL - Oracle 10g workshop I - Oracle 10g workshop II - Oracle Performance Tuning In order to get the properly knowledge or continuing my education in O
-
Is there a limit as to the number of values in a prompt? We have a report that a user created and she's trying to prompt for an account. It seems that the number of values begins with A and ends somewhere in the Cs.
-
I'm trying to user reflector installed on windows 7
On a corporate network. My PC appears in the mirroring icon on my iphone4s 6.1.3 but when I click on the name I don't get the option to mirror. Same thing at home using same pc on home wifi. My laptop "name" appears ok on the phone - so reflector see