Find browser or applets absolute position
Hi,
I am designing an applet where I open a number of small pop up windows at the beginning of the applet. Users of this system have two monitors, thus I need to determine where they have positioned the browser so that the windows will open above the browser. At the time the windows open there is nothing else on the screen so getLocation doesn't work.
If I can determine the absolute position of the applet this would also do.
All help would be greatly appreciated.
I use the following to get a reference to a Frame which I pass to a JDialog constructor to ensure that the Dialog is always centred over an Applet no matter where the Applet is positioned on screen. Maybe you can adapt it for your needs.
public Frame getDialogFrame()
/* creates and positions a Frame used by dialogs
* to ensure that dialog is modal and centred over the Applet
Object parent = this.getParent();
while(!(parent instanceof Frame))
parent=((Component)parent).getParent();
Frame dialogFrame = (Frame) parent;
Point p = this.getLocationOnScreen();
dialogFrame.setLocation(p.x, p.y);
return dialogFrame;
}
Similar Messages
-
Can Layers be given RELATIVE, rather than ABSOLUTE position
I'm having no luck finding an answer to this in HELP. I place
the layer's anchor in a table, then position the layer. If I
subsequently add (or remove) any lines above the anchor, everything
on the page moves down (or up), but the layer stays where it was,
relative to the page, not the anchor.
If there are several layers on the page this means a wholeot
of repositioning every time I do an edit up-page.
Any advice?This may help you understand positioning a bit -
There are 4 different types of positioning:
Absolute
Relative
Fixed
Static
Here is a brief explanation of each kind of positioning (with
regard to
placement of elements on the page only)....
Position:absolute (or A/P elements)
This does several things -
1. It 'removes' the element from the flow of the code on
the page so that
it can no longer influence the size or position of any other
page element
(except for those contained within it, of course).
2. The absolutely positioned element takes its position from
the position of
its closest PARENT *positioned* element - in the
absence of any explicitly
positioned parent, this will default to the <body> tag,
which is always
positioned
at 0,0 in the browser viewport.
This means that it doesn't matter where in the HTML code the
layer's code
appears (between <body> and </body>), its
location on the screen will not
change (this assumes that you have not positioned the A/P
element within
a table or another A/P element, of course).
Furthermore, the space in
which
this element would have appeared were it not positioned
is not preserved
on the screen. In other words, absolutely positioned elements
don't take
up any space on the page. In fact, they FLOAT over the page.
Position:relative (or R/P elements)
In contrast to absolute positioning, a relatively positioned
page element is
*not* removed from the flow of the code on the page, so
it will use the
spot
where it would have appeared based on its position in
the code as its
zero point reference. If you then supply top, right,
bottom, or left
positions
to the style for this element, those values will be
used as offsets from
its
zero point.
This means that it DOES matter where in the code the
relatively positioned
element appears (, as it will be positioned in that location
(factoring in
the offsets) on the screen (this is true for any placement in
the code).
Furthermore, the space where this element would have
appeared is
preserved in the display, and can therefore affect the
placement of
succeeding elements. This means that the taller a relatively
positioned element is, the more space it forces on the page.
Position:static
As with relative position, static positions also "go with
the flow". An
element with a static position cannot have values for
offsets (top, right,
left, bottom) or if it has them, they will be ignored. Unless
explicitly
positioned, all div elements default to static positioning.
Position:fixed
A page element with this style will not scroll as the page
content scrolls.
Support for this in elements other than page backgrounds is
quirky
There are several other things you need to know:
1. ANY page element can be positioned - paragraphs, tables,
images, lists,
etc.
2. The <div> tag is a BLOCK level tag. This means that
if it is not
positioned or explicitly styled otherwise, a) it will always
begin on a new
line on the screen, and b) it will always force content to a
new line below
it, and c) it will always take up the entire width of its
container (i.e.,
width:100%).
3. The placement of A/P elements *can* affect the BEHAVIOR of
other
elements
on the page. For example, a 'layer' placed over a hyperlink
will mask that
hyperlink.
You can see a good example of the essential difference
between absolute and
relative positioning here -
http://www.great-web-sights.com/g_layersdemo.asp
You can see a good demonstration of why using layers for a
page layout tool
is dangerous here -
http://www.great-web-sights.com/g_layer-overlap.asp
Based on this, a static div (no longer a 'layer') would be
what you want.
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com
- Template Triage!
http://www.projectseven.com/go
- DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs,
Tutorials & Resources
http://www.macromedia.com/support/search/
- Macromedia (MM) Technotes
==================
"bwilsonduncan" <[email protected]> wrote in
message
news:[email protected]...
> I'm having no luck finding an answer to this in HELP. I
place the layer's
> anchor in a table, then position the layer. If I
subsequently add (or
> remove)
> any lines above the anchor, everything on the page moves
down (or up), but
> the
> layer stays where it was, relative to the page, not the
anchor.
>
> If there are several layers on the page this means a
wholeot of
> repositioning
> every time I do an edit up-page.
>
> Any advice?
> -
How do i add a Scroll Bar to a JList Component using absolute positioning?
I've got a applet whose content pane is set to null. I've create a jlist component on this applet and using absolute positioning set the bounds at
ListBox1.setBounds(380,10, 500, 500);.
My problem is creating add a scroll bar to the list box.
JScrollPane scrollPane = new JScrollPane(ListBox1);
C.add(scrollPane);
The above code is what i use and when i run this applet i don't see the list box at all. How do i add a scrollbar to this list box or JList component. Please help.You need to setBounds() on the JScrollPane, not the JList.
The JScrollPane is the component that is being added to the panel. -
Adding a Layer (absolute position div) to a locked page
Maybe I am just not understanding templates but I have a
really simple one that has one editable region called "content". I
want to add a absolute positioned div to the content area but DW
tells me this would require changing code that is locked by the
template. I thought that the editable area automatically put in by
DW would accommodate the added code (css) that DW puts in when
adding a template to the page.
So what is the Editable area called "Head" used for anyways
if not for situations like this?
ThanksHere's the problem with layers in template child pages, and a
simple
solution.
When you DRAG a layer onto the page in DW (this means you
click on the layer
icon in the Insert Toolbar and drag the layer on the page),
DW wants to put
the code for that layer immediately under the body tag, e.g.,
BEFORE DRAG -
<body...>
<table>
AFTER DRAG -
<body ...>
<div id="foo" style="position:absolute; ...>LAYER
STUFF</div>
<table>
In a template child page, this region is usually not part of
your editable
region, and so the layer's code is rejected by the template
engine. This is
a bad thing.
If instead of dragging the layer onto the page, you use
INSERT | Layer, that
should work provided your cursor is in an editable region,
but since
editable regions are usually within tables or other layers,
you have just
broken one of the rules listed above. This is also a bad
thing.
THE SOLUTION -
Open your template page in DW, and create a special place
where it is SAFE
to put your layers. In code view, find this -
</body>
and click so that your cursor insertion point is just to the
left of
</body>.
Now, use INSERT | Template Objects > Editable Region, and
name this region
"Layer Pad" or something like that.
When you save your template page, all your child pages will
now have the
LayerPad editable region on them.
THE BIG FINISH -
On any child page where you need a layer, just click in this
editable
region, and use INSERT | Layer. Bada bing, bada boom.
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com
- Template Triage!
http://www.projectseven.com/go
- DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs,
Tutorials & Resources
http://www.macromedia.com/support/search/
- Macromedia (MM) Technotes
==================
"htown" <[email protected]> wrote in message
news:[email protected]...
> Maybe I am just not understanding templates but I have a
really simple one
> that
> has one editable region called "content". I want to add
a absolute
> positioned
> div to the content area but DW tells me this would
require changing code
> that
> is locked by the template. I thought that the editable
area automatically
> put
> in by DW would accommodate the added code (css) that DW
puts in when
> adding a
> template to the page.
>
> So what is the Editable area called "Head" used for
anyways if not for
> situations like this?
>
> Thanks
>
> -
Problem with Absolute Positioning
I have a LARGE number of web pages (>1500) that have fields that are absolutely positioned. I have to process these pages (JSPs) and create a temporary HTML file that will be edited in Dreamweaver. The editing will only modify the CSS file: the temporary HTML is throw-away.
The goal is to use Dreamweaver to organize fields on the screen and have it modify only the position in the CSS.
My problem is that when I create the temporary HTML, it looks fine in the browser, but Dreamweaver displays the elements using a normal flow, and not using the absolute position. I have checked the "AP Elements" tab in DW, and it shows all my fields and the "Prevent overlaps" checkbox is UNCHECKED.
Any guidance will be appreciated...
Here is a small HTML example (CSS below that):
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>CL0350</title>
<link rel="stylesheet" href="example.css">
<style type="text/css">
body {
background-color: #efe;
#formContainer {
width: 802px;
height: 564px;
font-family: Arial, Helvetica, sans-serif;
font-size: 11px;
font-weight: bold;
border: 3px #444 solid;
background-color: white;
position: relative;
</style>
</head>
<body>
<div id="formContainer">
<div id="lblEPP_MEMBER_NBR">Member#</div>
<div id="lblEPP_YMDRCVD">Recv Dt</div>
<input id="txtEPP_MEMBER_NBR"><input id="txtEPP_YMDRCVD"></div>
</body>
</html>
And finally, the CSS:
#lblEPP_MEMBER_NBR
white-space:nowrap;
POSITION:absolute;
left:17px;
top:43px;
#txtEPP_MEMBER_NBR
POSITION:absolute;
LEFT:17px;
TOP:62px;
WIDTH:110px;
#lblEPP_YMDRCVD
white-space:nowrap;
POSITION:absolute;
LEFT:542px;
TOP:43px;
#txtEPP_YMDRCVD
POSITION:absolute;
LEFT:542px;
TOP:62px;
WIDTH:92px;Ahh - nevermind. I see you fixed your code.... Now I'll take a look.
On this page in DW, the fields seem to be placed using the absolute positioning, not the normal flow. Is the additional CSS contained in the externally linked CSS file?
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>CL0350</title>
<link rel="stylesheet" href="example.css">
<style type="text/css">
body {
background-color: #efe;
#formContainer {
width: 802px;
height: 564px;
font-family: Arial, Helvetica, sans-serif;
font-size: 11px;
font-weight: bold;
border: 3px #444 solid;
background-color: white;
position: relative;
#lblEPP_MEMBER_NBR
white-space:nowrap;
POSITION:absolute;
left:17px;
top:43px;
#txtEPP_MEMBER_NBR
POSITION:absolute;
LEFT:17px;
TOP:62px;
WIDTH:110px;
#lblEPP_YMDRCVD
white-space:nowrap;
POSITION:absolute;
LEFT:542px;
TOP:43px;
#txtEPP_YMDRCVD
POSITION:absolute;
LEFT:542px;
TOP:62px;
WIDTH:92px;
}</style>
</head>
<body>
<div id="formContainer">
<div id="lblEPP_MEMBER_NBR">Member#</div>
<div id="lblEPP_YMDRCVD">Recv Dt</div>
<input id="txtEPP_MEMBER_NBR"><input id="txtEPP_YMDRCVD"></div>
</body>
</html> -
Newbie Q - Absolute position of items / regions
Hello,
Is it possible to set an absolute position for items / regions?
I'd like to be able to display an item at coordinates (x,y) on screen, but all I could find was how to position my items relatively to other items / regions.
Please help.
Thanks.
Anat :o)Hi Anat,
Yes you can absolutely position regions.
In the Region Header enter in something like:
<div style="position:absolute; top:100px; left:100px;">
and put the following in the Region Footer:
</div>
You will need to experiment with this to see what affect this has on the rest of the page. There is a discussion on this forum about using DIV tags instead of TABLE tags as a means of laying out pages - not sure how far this has got yet, but it would involve rewriting the page templates.
Regards
Andy -
Hello,
Is it possible to send the NXT motor to an absolute position? I want the motor to act as a servo so that i can use it to steer an rc car.Hello Frank,
As I told you, you can easily find the limits by running the motor and checking when the position is not evolving anymore. Once that happens, it means that you have found one limit. Then you can do the same in reverse direction to find the other one.
Here is a simple example I quickly did to find one limit:
Disclaimer: The example Code is provided As Is. It has not been tested or validated as a product, for use in a deployed application or system, or for use in hazardous environments. You assume all risks for use of the Code and use of the Code is subject to the Sample Code License Terms which can be found at: http://ni.com/samplecodelicense
From there, you should be able to find the other limit and compute the center.
Does this reply to your need?
Cédric | NI Belgium -
How to find browser have java swing plugins
how to find browser have java swing plugins
Hi, you can detect it. If it is not there, you can make the installation automatically. Here is an example.This will not work with NN4 browser unless the user has Enable Java Plugin checked (see Edit | Preferences | Advanced. Nor will it work under IE if the user has disabled Java.
The best solution, IMHO, is to trigger a JavaScript function and check to see if the applet is created. You can try:
<html>
<head>
<title>....</title>
<script>
function checkApplet() {
if (document.myApplet!!=null) return true;
alert("You need to enable Java and have the proper plugin to view this document:);
return false;
</script>
<noscript>You need to turn on JavaScript to view this page</noscript>
<body onLoad="checkApplet()">
...... // applet tag goes here
</body>
</html>
Remember that you cannot call your applet to test its status.
V.V. -
I asked about automatic backup of bookmarks and received the following answer:You can make Firefox 3 create an automatic HTML backup (bookmarks.html) when you exit Firefox if you set the pref [http://kb.mozillazine.org/browser.bookmarks.autoExportHTML browser.bookmarks.autoExportHTML] to true on the about:config page. That backup is created by default in the profile folder as bookmarks.html, but you can set the file name and path via the pref [http://kb.mozillazine.org/browser.bookmarks.file browser.bookmarks.file] on the about:config page. I went to about:config page and toggled browser.bookmarks.autoExportHTML to “Yes” and it’s working. However, I want to change the file location, but I can’t find browser.bookmarks.file in the list.
The browser.bookmarks.file preference does not exist by default. Right-click in about:config and select "New > String" to create it.
-
How can i detect the version of the browser in applet
i wanto detect the version of the browser in applet
can you help me?Hi glovebx!
Currently there isn't way via java applets since the nearest method is System.getProperty(String key)
and there isn't a proper key allowed to browser version/name.
Try to get this browser property via javascript then interact with applet using package netscape.javascript.JSObject.
Best Regards.
P.S.: Visit http://developer.netscape.com to read about this issue. -
Page footer absolute position issue - Crstal Reports
Hi,
I have a page footer section in the crystal report.
There are 2 sections Page footer A and Page footer B.
Here I am displaying Page Footer A in the first page and Page Footer B on all the pages.
Here the issue is, as I applied a suppress condition on page footer A in order to display only on frist page. This is working fine. But in the second page the page footer B is displayed a bit above the end of page as the page footer A is suppressed.
Can we set absolute position for page footer B? So that, the page footer B will be displayed at the same way in all the pages as like the first page.
Thankyou,
Regards
Gowtham Sen.Hi All,
The issue got resolved. I used the option underlay. It worked well.
Thanks. -
Box model/none absolute positioning with flash
In recent years none-absolute positioning (or box model positioning) has become the norm with HTML/CSS
this is uselfull for dynamic functions which appear on an event (such as an object which appears when a button is clicked on or a error message that appears when a form box is given invalid input because it automatically inserts itself it the right place.)
One very important example of this is when you have a form which automatically produces an error message and the error message appears bellow the input area which caused it and the rest of the page is pushed down.
With none absolute positioning the developer does not need to worry about this.
But if the objects are given absolute position then it becomes a massive problem, the developer has to go about giving the objects differetn positions dependant on if dynamic objects appear or not
potentially the developer has to consider all possible variables, and code if statements which determine the position of all static objects for all possible variables which dynamic objects could take.
so does flash have a "none absolute positioning" solution to this problem.Before you get all happy and pleased with yourself, APDivs or Layers seldom work well as a primary layout method. Here are some reasons why:
http://apptools.com/examples/pagelayout101.php
You're much better off using default CSS positioning (which is no positioning at all) along with CSS margins, padding and floats. If you don't believe me, check your page in non-IE browsers with increased/decreased text-sizes (zoom, text only).
From Tables to CSS Web Design Part 1 -
http://www.adobe.com/devnet/dreamweaver/articles/table_to_css_pt1.html
Nancy O.
Alt-Web Design & Publishing
Web | Graphics | Print | Media Specialists
http://alt-web.com/
http://twitter.com/altweb
http://alt-web.blogspot.com -
Many comments have been made elsewhere about the wisdom of
using 'absolute', particularly when a crossbrowsers are considered
and user's adjustment of text size..to quote one problem...
So, in order to eliminate these glitches from my pages, I
should apparently convert to 'static'..
What would be the steps to take to accomplish this without
too much hassle. I do have a lot of CSS code, which, I guess, when
adjusted would take care of some of the problems.
Is there a tutorial/publication which deals with this
procedure?Any element without an explicit positioning style is static,
by default,
e.g.,
<html>
<head>
</head>
<body>
<div>This is a static div</div>
<p>This is a static paragraph</p>
</body>
> So, in order to eliminate these glitches from my pages,
I should
> apparently
> convert to 'static'..
That's a gross oversimplification. You should re-design your
layout so that
the page elements are placed on the page as dictated by THE
NORMAL FLOW,
mediated through the CSS rules. Simply taking a page that has
been designed
using absolutely positioned elements, and converting the
absolute position
to static position (by removing the positioning altogether)
will most likely
not work very well. I think you understand this, but I'm not
sure.
> I do have a lot of CSS code
This, too, is a bit troubling. Having a lot of CSS often
means inefficient
use of rules and selectors.
In general, you don't need many custom classes. And, in fact,
they
make your life more difficult when you come back to maintain
the page a year
later. Use ID selectors and create descendent selector rules.
An example -
#maintable { .... }
#maintable td { .... }
#maintable td table { ... }
each of those rules would apply explicitly to a) this table -
<table id="maintable">,
and b) this cell -
<table id="maintable">
<tr>
<td>...</td>
</tr>
</table> (and all others in that table),
and to this table -
<table id="maintable">
<tr>
<td>
<table>
<tr>
<td></td>
</tr>
</table>
</td>
</tr>
</table>
Then you could use this rule -
#maintable table td.special { .... }
to apply to this cell explicitly -
<table id="maintable">
<tr>
<td>
<table>
<tr>
<td class="special">this one</td>
<td>but not this one</td>
<td class="special">this one</td>
<td>but not this one</td>
</tr>
</table>
</td>
</tr>
</table>
Also, it is not necessary to define default styles, e.g.,
font-weight:normal, unless you are trying to counteract some
cascading rule.
Further, it is not necessary to define styles that are
normally inherited,
e.g.,
body { font-family: Calibri, verdana, arial, helvetica,
sans-serif; }
will style all characters used on the page, no matter where
they are located
or in which container.
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
==================
"Karlhevera" <[email protected]> wrote in
message
news:[email protected]...
> Many comments have been made elsewhere about the wisdom
of using
> 'absolute',
> particularly when a crossbrowsers are considered and
user's adjustment of
> text
> size..to quote one problem...
>
> So, in order to eliminate these glitches from my pages,
I should
> apparently
> convert to 'static'..
> What would be the steps to take to accomplish this
without too much
> hassle.
> I do have a lot of CSS code, which, I guess, when
adjusted would take care
> of
> some of the problems.
> Is there a tutorial/publication which deals with this
procedure?
>
> -
Use incremental rotary encoder to measure the absolute position and velocity
Hi all,
I faced a problem by using incremental rotary encoder to measure the absolute position of the rotation.
I'm not using NI-Daqmx but NI-motion module. In NI-motion module, I use read encoder position.vi to read the position of the encoder.
However, the readings is in incremental form. I'm doing the feedback control, so I need the absolute position and velocity.
Is there any functions or vi in the labview that can be used to transform the information of incremental encoder to the absolute one?
Thanks
Jun WongJun,
1. The incremental encoder provides incremental position. After switching on the encoder power the encoder counts upwards or downwards. For the absolute position you need the index (R or I) signal. I don't know which type of incremental encoder you have but there should be A, B and (I or R) signals. The index signal should reset the counter to zero setting this way a pseudo-absolute-position (which is lost after the first switch of). Most of the motion controllers have a mode, just after switch on, in which the controller search for the Index. This mode is called Homing.
2. Velocity. It's very simple. You sample the position with a fix sampling clock. Let's say: 10kHz. The speed is: (Actual Position - Previous Position) / Sampling Period. Pos[n] = 10.000inc, Pos[n-1] = 9.900inc. Speed = 10.000 - 9.900 / (1/10kHz) = 1.000.000 inc/sec. If one increment is 0.0001mm then the speed is 100mm/sec.
Paul -
Could not find agent library in absolute path
Hi,
I have a JVMTI agent which works on windows that I am trying to port to linux.
I have compiled to code on Ubuntu 10.04 using Eclipse and have created shared library .so file.
When I try to run an application with the agentpath argument, I get the error: "Could not find agent library in absolute path"
When trying to run the mtrace sample from the java JDK, it works fine.
My Java version is:
java version "1.6.0_20"
Java(TM) SE Runtime Environment (build 1.6.0_20-b02)
Java HotSpot(TM) Client VM (build 16.3-b01, mixed mode, sharing)
I also tried running nm | grep Agent_OnLoad and got the following:
00029220 T Agent_OnLoad
00036230 b ZGVZ12AgentOnLoadE4data
00030720 r ZZ12AgentOnLoadE19__PRETTY_FUNCTION__
00036240 b ZZ12AgentOnLoadE4data
My agent references several libraries such as boost asio and log4cxx could it be related somehow to these?
I think it might be some sort of compilation issue because on windows it works fine.
ThanksI managed to solve my problem.
It turned out that the error was caused by missing referenced libraries that were not linked in to my so file.
Once I added all of the required libraries, the agent started working.
Maybe you are looking for
-
How do I install Adobe digital editions on my iPad?
How do I install Adobe digital editions on my iPad? I have an IPad Air 2, iOS 8.1.2. I ordered some ebooks that required the download of Adobe Digital Editions. I select the supplied link to the Adobe site, select download, and I am given the option
-
Connecting new router from Verizon
We just received a new Actiontec router from Verizon. Plugged in power cord and phone line and can not get a connection. What am I doing wrong? On the last router (Westell) we did not have to have an ethernet cable to use the router and I assumed we
-
Change SQL server instance collation after Sharepoint installation
Installed Sharepoint 2013 with the SQL Server 2012 db instance using the default collation Latin1_General_CI_AS. SQL is just used for Sharepoint 2013. the system is not released yet for production Run the installation and configurations and database
-
3 Months and Still No Real Fix?
Not to be flogging a dead horse, but....it's been almost three months since LR4 was officially released, and Adobe still hasn't issued an official fix for all (or any) of the known issues. Sure, you can use RC2, but....it seems LR4 was released too
-
Everytime I try to download Reader 9.1 it only downloads to 76% and then won't continue. I've unistalled all acrobat stuff on the computer. I get no error messages, it just stalls and won't continue. This happens every time and I've tried probably