How to create a window with its own window border other than the local system window border?

How to create a window with its own window border other than the local system window border?
For example, a border: a black line with a width 1 and then a transparent line with a width 5. Further inner, it is the content pane.
In JavaSE, there seems to have the paintComponent() method for the JFrame to realize the effect.

Not sure why your code is doing that. I usually use an ObjectProperty<Point2D> to hold the initial coordinates of the mouse press, and set it to null on a mouse release. That seems to avoid the dragging being confused by mouse interaction with other nodes.
import javafx.application.Application;
import javafx.application.Platform;
import javafx.beans.property.ObjectProperty;
import javafx.beans.property.SimpleObjectProperty;
import javafx.collections.FXCollections;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.geometry.Point2D;
import javafx.geometry.Pos;
import javafx.scene.Node;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.ChoiceBox;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.StackPane;
import javafx.scene.layout.VBox;
import javafx.scene.paint.Color;
import javafx.stage.Stage;
import javafx.stage.StageStyle;
import javafx.stage.Window;
public class CustomBorderExample extends Application {
  @Override
  public void start(Stage primaryStage) {
  AnchorPane root = new AnchorPane();
  root.setStyle("-fx-border-color: black; -fx-border-width: 1px; ");
  enableDragging(root);
  StackPane mainContainer = new StackPane();
    AnchorPane.setTopAnchor(mainContainer, 5.0);
    AnchorPane.setLeftAnchor(mainContainer, 5.0);
    AnchorPane.setRightAnchor(mainContainer, 5.0);
    AnchorPane.setBottomAnchor(mainContainer, 5.0);
  mainContainer.setStyle("-fx-background-color: aliceblue;");
  root.getChildren().add(mainContainer);
  primaryStage.initStyle(StageStyle.TRANSPARENT);
  final ChoiceBox<String> choiceBox = new ChoiceBox<>(FXCollections.observableArrayList("Item 1", "Item 2", "Item 3"));
  final Button closeButton = new Button("Close");
  VBox vbox = new VBox(10);
  vbox.setAlignment(Pos.CENTER);
  vbox.getChildren().addAll(choiceBox, closeButton);
  mainContainer.getChildren().add(vbox);
    closeButton.setOnAction(new EventHandler<ActionEvent>() {
      @Override
      public void handle(ActionEvent event) {
        Platform.exit();
  primaryStage.setScene(new Scene(root,  300, 200, Color.TRANSPARENT));
  primaryStage.show();
  private void enableDragging(final Node n) {
   final ObjectProperty<Point2D> mouseAnchor = new SimpleObjectProperty<>(null);
   n.addEventHandler(MouseEvent.MOUSE_PRESSED, new EventHandler<MouseEvent>() {
      @Override
      public void handle(MouseEvent event) {
        mouseAnchor.set(new Point2D(event.getX(), event.getY()));
   n.addEventHandler(MouseEvent.MOUSE_RELEASED, new EventHandler<MouseEvent>() {
      @Override
      public void handle(MouseEvent event) {
        mouseAnchor.set(null);
   n.addEventHandler(MouseEvent.MOUSE_DRAGGED, new EventHandler<MouseEvent>() {
      @Override
      public void handle(MouseEvent event) {
        Point2D anchor = mouseAnchor.get();
        Scene scene = n.getScene();
        Window window = null ;
        if (scene != null) {
          window = scene.getWindow();
        if (anchor != null && window != null) {
          double deltaX = event.getX()-anchor.getX();
          double deltaY = event.getY()-anchor.getY();
          window.setX(window.getX()+deltaX);
          window.setY(window.getY()+deltaY);
  public static void main(String[] args) {
  launch(args);

Similar Messages

  • HT1430 I was given an ipad 2.  How do I reconfigure it with my own settings, etc. and erase the previous owners informations?

    I was given an ipad 2.  How do I reconfigure it with my own settings, etc. and erase the previous owners informations?

    But note, if the previous owner turned on Find My in iCloud and has not turned that off you will not be able to do anything with that iPad without the previous owner's Apple ID...there is an Activation Lock as part of iOS 7.0.4 that cannot be bypassed so you have to have that Apple ID and password if it has been turned on.

  • How do I get an iPod touch to turn on other than the normal way. It has been dropped and all I can get is a blank screen. Have tried holding the HOME button down for 30 sec. but that didn't work.

    How does one get an iPod nano to turn on other than the "normal" way? This one has been dropped and all I can get is a blank screen. I have tried holding down the HOME button to restart it but no go. When I connect it to my computer, I am told to enter the PASSCODE which I cannot do as there is no touchpad.

    David ..
    Your topic refers to an iPod touch
    Then you say:  How does one get an iPod nano to turn on ......
    If it's an iPod touch, try a reset.
    Press and hold the Sleep/Wake button and the Home button together for at least ten seconds, until the Apple logo appears.
    If that doesn't help, whether it's an iPod nano or touch, it probably needs service >  Apple - Support - Service Answer Center

  • How to create a structure with my own fields

    Hi,
    can any body please explain me in creating a structure iwth my own field names

    hi friend.
      here is the code to create structure.
      data: begin of stru,
              ebeln type ekko-ebeln,
              bukrs type ekko-bukrs,
              lponr type ekko-lponr,
              ekogrp type ekko-ekogrp,
              end of stru.
    this will create the structure and i have defined the fields from ekko table. you can define the fields for your table in the same pasion. you can call any were in your program using the structre name with field name.
    Suppose you need to write the fields.The statement is
    write : /  stru-bukrs,stru-ekogrp.
    This is the way to write the structure.
    NOTE:
    begin of stru and end of stru is structure .
    if u write the state like this
    begin of itab occurs 0,
    end of itab.
    its a internal table.

  • How to create number ranges with "OK60" transaction or any other.

    Hello,
    I need to create a new number range to asigne to a document type , using transaction OK60 ( the error says this transaction).
    but I only can display with this transaction, and I would like to update.
    Is there any other transaction to do this , or is there any way to do this with this transaction OK60?
    Thank you very much.
    Kind regards
    Olga

    Hi,
    OK60 indeed is used for creating number ranges for FI/CO earmarked funds transactions. You should press on 'Pencil' button and create an interval. If for some reasons, you cannot do this via this transaction, try using SNRO transaction, with IRW_BELEG parameter. If this also fails, then apply to BASIS team to check your authorizations.
    Regards,
    Eli

  • How do I create a Calendar custom repeat or custom alert other than the choices given?

    I would like to create a custom repeat for my calendar such as every 6 weeks or, every other month or whatever choice - - the only choices are "Every Day, Every week, every 2 weeks, every month, every year"?    I would also like to create a custom alert for 2 weeks before or 10 days, etc and there is no "custom" option???

    Whenever you find out let me know. I wanted to assign a text tone to someone and now in iOS 7 i can't. Or I haven't figured this out yet.

  • How do I start a streaming .flv at a point other than the beginning of the video file?

    I have a 1.5 hour flv video that is streaming from a
    Microsoft 2003 box with Wowza Media Server installed. Using
    Actionscript 3 and the FLVplayback component I would like to start
    the video at a point about 10 seconds from the beginning.
    This code snippet does not work:
    myVideoFile.seek(10);
    myVideoFile.play();
    Though the video seeks to the proper point in the video file,
    the play() call sends it back to the beginning. Thanks for your
    help!

    That's the ticket!
    <totallyRocks>Jamesabth</totallyRocks>

  • How can we move a member in a BSO cube other than the manual move in EAS?

    When I add a member to the dimension, it gets added at the bottom.
    Is there a way we can add at the top as a first child of that current member. I don't want to sort.
    Or is there a way we can move the member by any other means other than manually moving it?
    because I would like to schedule this process.
    Thanks,

    unless you delete and readd the members of the dimension (sorted in the dimension build file in the order you want, or using the sort frature, there is no way to add the members as you want (Well you could use the api to do it) but I don't think that is what you are looking for

  • Can two or more devices use the same Apple  account with different cell phone numbers. I want to use FaceTime on a my 5s and my wife wants her own FaceTime on a new iPad Air with its own cell number but be linked with me with iCloud to share music

    I have a 5s with an apple account and wife has a iPad air with its own cell number. Does the iPad need it's own apple account to use it's own phone number so her FaceTime calls are not sent to my phone. We want to be able to link each device to iCloud and share music, photos, ect. iPad iMessage and FaceTime have my cell number activated.

    How to use multiple iPods, iPads, or iPhones with one computer
    http://support.apple.com/kb/HT1495
    How to Share a Family iPad
    http://www.macworld.com/article/1163347/how_to_share_a_family_ipad.html
    Using iPhone, iPad, or iPod with multiple computers
    http://support.apple.com/kb/ht1202
    iOS & iCloud Tips: Sharing an Apple ID With Your Family
    http://www.macstories.net/stories/ios-5-icloud-tips-sharing-an-apple-id-with-you r-family/
    How To Best Use and Share Apple IDs across iPhones, iPads and iPods
    http://www.nerdsonsite.com/blog/2012/06/07/help-im-appleid-confused/
     Cheers, Tom

  • When I create a stickie note, I can not save any font size other than the default.  How do I save a stickie with a larger or different font?

    How do I save a stickie note with a different font size other than the default?  When I create a note and save it using a larger font, it reopens with the default.

    Unlikely, I'm afraid.
    The LMS has no control over the playbar that pauses or plays the Captivate content.
    In a Multi SCORM package, the LMS also may be showing a TOC in the SCORM player with links to launch the lesson modules.  This TOC is in addition to the TOC inside the Captivate project file which gives access to sections of the module by jumping to slides that begin those sections.  But the LMS doesn't usually give you any control over the look and feel or functionality of that TOC either. 
    If your client is adamant that they want complete control over these areas, then your best option may be NOT to build this course with Captivate but build it from the ground up with another tool.  E.g. Flash, or Dreamweaver.  Either way, that will add a lot more time and expense to the project.  But if the client has the budget and is unwilling to budge on their requirement, then that's what I would be telling them to do.

  • HT1451 A new album purchase downloaded each song as an individual album with its own album cover. How do I consolidate all songs under just one album cover like the rest of my library?

    A new album purchase downloaded each song as an individual album, each with its own album cover. How do I consolidate all songs under just one album cover like the rest of my library? How did this happen?

    Generally all you need to do is fill in an appropriate Album Artist. For more details see my article on Grouping Tracks Into Albums, in particular the topic One album, too many covers.
    BTW, are you really still using Windows 2000?
    tt2

  • ITunes creates duplicate tracks on its own

    Hello everyone,
    I noticed recently that iTunes is creating duplicate tracks on its own. The new “tracks” all reference to the same file. Sometimes there are up to 4 duplicates (see screenshot). As you can see on the far right of the image, it seems that every time I ran iTunes the tracks are added.
    I did not change anything recently, but noticed that iTunes also updates my Cover Art, even though I explicitly unchecked the checkbox the settings…might be connected to my issue.
    Any advice is much appreciated!
    regards
    modtastic

    Is the media folder stored on an external drive? If you start iTunes with an external disconnected it will "notice" and mark all tracks as missing. If you then add media by scanning folders it won't notice that it is already connected to the files and will add them again. Next time you start iTunes you can have two tracks linked to the same physical file.
    How do you normally add media to the library?
    To check your library for duplicates use Shift > View > Show Exact Duplicates as this is normally a more useful selection. Keep holding down shift until you have clicked on the text Show Exact Duplicates or it may still use the loser definition. If you don't see a menu bar press Ctrl+B to reveal it or Alt to show it temporarily.
    If you find that you have true duplicates you need to manually select all but one of each group to remove, or use my DeDuper script if you don't want to do it by hand. The script attempts to take account of different types of duplicates which need to be handled differently, merges playcounts and preserves playlist membership. Please take note of the warning to backup your library before deduping. See this thread for background.
    iTunes doesn't generally do much in the way of background media updates, but it may reveal those enacted by something else, such as Windows Media Player.
    tt2

  • How to create ios environment with adobe id?

    Hi , i am trying to create ios environment in windows platform.
    can any one please tell me, how to create IOS environment with adobe id.
    I a created adobe id and inserted code into it. But its running (Since one hour), and no response.
    Any one have idea on it, please let me know.
    Thanks in advance....
    Message was edited by: pathi rskumar

    Hi,
    If you have already set the number range as an external range.
    Then just passing the transaction type to field 'process_type' and external id to field 'object_id' of table ct_orderadm_h. Sales order will created with the assigned external id.
    Hope this help.
    cheers,

  • Multiple ifs services each with its own agents

    I would like to be able to do the following:
    Ability to run multiple ifs applications on the same box (beefy one) each with its own set of agents. Ifs 1.0 config tool (ifsconfig) always creates IfsDefault.props file. Can I rename that file to something else and use the new name as the service name in the application?
    What about the agents defs? Do I need different server managers? How do I tell which service relates to which server manager?
    I would like to know how to do this on both ifs 1.0 and ifs 1.1.
    Thanks.
    null

    Does anyone know the answer to this?

  • How to create dynamic window in smartform

    <i>HI Floks</i>
    my requirement is invoice smartform having few line items .i can print this line items with different categories with dynamically placed in smartfom. there how many items with in particular category print its self . how is it possible to printing .is it possible to print dynamic fields and window without changing driver program and structure .How to create dynamic window.
    any body knows reply me fast
    thanks in advance ,
    suresh

    Hi suresh,
        You can create all the windows, but if you go to specific window you will see different tabs like general attributes, output options and conditions. In that conditions tab, you can give condition. so based on that condition, that window will be printed.
    Dont forget to reward points if helpful.
    regards,
    Chandra.

Maybe you are looking for

  • Error logging approaches

    I would like to hear how people have implemented various error logging approaches in Forte applications. Forte produces log files automatically for service partitions in $FORTE_ROOT/log and pops up dialog boxes with uncaught exceptions for client par

  • Best way to migrate to new server?

    We're moving from a G5 XSERVE with an old RAID to a new one with the Promise. Will all the permissions (we're bound to Active Directory) carry over without an issue or will we have to go through Workgroup Admin and re-do everything (which would take

  • ITunes 10.4 won't download because it has an invalid signature

    iTunes 10.4 won't download because it has an invalid signature

  • Restoring iPod after two years of setting on the shelf

    I plugged in my iPod to my computer. All of my music was listed on the screen and everything seemed to work fine as long as I was attached to the computer. After several hours the fully charged icon displayed. When the iPod is disconnected from the c

  • Nexus OSPF cost calculation issue

    Hi, We have core Nexus 7K switch and its further connected to 2 switches via port-channel-1 and port-channel-2. Now port-channel 1 connected to one of the switch has 4 gig ports and port-channel 2 connected to another switch has 3 gig ports. We are r