Trouble during dragging JWindow with my own title bar!

Hello Everyone!
While I drag window something like a conture remains behind, aspecially on white background.
Similar code in VB works perfectly.
import javax.swing.*;
import javax.swing.border.*;
import java.awt.*;
import java.awt.event.*;
class NoTitleBar extends JWindow
  JLabel label = new JLabel("Title Bar  ");
    public static void main(String[] args)
      new NoTitleBar();
  public NoTitleBar()
      getContentPane().setLayout(null);
      label.setHorizontalAlignment(JLabel.CENTER);
      label.setBounds(0,0,400,25);
      label.setOpaque(true);
      label.setBackground(Color.blue);
      label.setForeground(Color.white);
      label.setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED,new Color(100,100,255),new Color(0,0,100)));
      BevelBorder bb = new BevelBorder(BevelBorder.RAISED, Color.blue,Color.blue);
      getContentPane().setBackground(Color.pink);
      getContentPane().add(label);
      setBounds(0,0,400,400);
      setVisible(true);
      label.addMouseListener(new labelListener());
      label.addMouseMotionListener(new labelMotionListener());
      addMouseListener(new MouseAdapter(){
               public void mouseReleased(MouseEvent me){
                 dispose();
                 System.exit(0);
    boolean moved = false;
    int coorX, coorY;
    class labelListener extends MouseAdapter
        public void mousePressed(MouseEvent me)
            moved = true;
            coorX = me.getX();
            coorY = me.getY();
        public void mouseReleased(MouseEvent me)
            moved = false;
    class labelMotionListener extends MouseMotionAdapter
        public void mouseDragged(MouseEvent me)
            if (moved){
              Point p = getLocation();
              setLocation((int)p.getX()+ me.getX()-coorX,(int)p.getY()+ me.getY()-coorY);

Works ok on my platform: NT 4, JDK 1.3.1_02. What are you running on/with?

Similar Messages

  • Can't drag windows around using the title bar-CS4

    I just upgraded to CS4 at work last week and I'm already regretting it. Firstly, using two monitors, CS4 must like my graphics card becasue as soon as I open a document and it begins to render the window, the main monitor loses it's signal and cuts off. So I have to hard shut down and make my 2nd monitor the main one, open CS4 and a file on that monitor, then make it the 2nd monitor and pass it over to my real first monitor with a file open and make that monitor the main one again. Added to that, randomly, files will open as tabs even though I have the option unchecked in prefs. I hate tabs, I want my windows floating. But I digress.
    My current issue is the file windows are not movable using the title bar. I can expand/contract every side grabbing the edge, but clicking, holding and dragging any of the title bar is ineffective. I can drag to tab to undock it, but once floating, the title bar is non-funtional for grabbing. I can also double click on it to tab, just not to drag.
    I use a mac at home and thankfully Adobe hasn't forced the edge to edge palette background on that platform. On the mac we get a 'classic view' or something that does away with the desktop blocking grey window background. Seriously, I can't stand the full screen look. Why can't windows have that option to have just the menu bar, palettes and file windows allowing the desktop to be visible? /rant

    A new video card is often a good idea if yours is over 2 years old.  Even the modern "budget" (e.g., ~$100) cards are hugely powerful nowadays.
    This page, I believe, could be a good starting point for everything you want to know:
    http://kb2.adobe.com/cps/404/kb404898.html
    This page, specifically, talks about tested video cards with Photoshop CS4:
    http://kb2.adobe.com/cps/405/kb405711.html
    A similar page for Photoshop CS5:
    http://kb2.adobe.com/cps/831/cpsid_83117.html
    -Noel

  • Problems with Compiz and Title bar,

    Hello , i've been trying to setup compiz with arch using the open source drives and i'v gotten it working how ever if i enable the screen decorate it freezes when i start fusion-icon and i have no button or ablity to move the windows in the title bar.
    i have a Radeon x1200 series graphics card
    also i would like to know how show the drives that are mounted on the desktop
    Last edited by livinglifeback (2010-01-06 22:13:30)

    So you are using fusion-icon and have Compiz enabled and Emerald set as your window decorator and that's when you run into trouble.  Correct me if I'm misunderstanding your problem, but if I'm not it's probably because none of the Compiz plugins are enabled by default.  Load the Compiz control center and start enabling some of the plugins.  At minimum you need windows, move windows, and plugins like that enabled.  Hope that helps.

  • Lab view Application with a Customized Title bar

    I am using Labview 2013. I need to change the color of the Application Title Bar to Black. I dug around quite a lot but did not come across any method to do this. Any suggestions or ideas?
    Thanks,
    Abel.

    Hello Abel,
    You should not dug any where else except NI Website. Your query is already been answered on NI Website. Just click here and "http://digital.ni.com/public.nsf/allkb/3155A70B46F115C98625769C007E962E" this may give you some detailed idea for which you are looking for. Kudos are most welcome.
    Kudos are always Welcome.... :-)
    Vinal Gandhi, CLD
    Software Engineer

  • Dragging Windows without grabbing the title bar

    Everyone,
    I'm trying to make the switch to OS X but there is one feature that I must have before switching. The feature is "Alt-Drag", the same feature that X Windows in Linux has. I use this in Windows as well with a third party utility.
    Basically the way this works is you press a keyboard modifier (like Alt or a combination there of) and then you can click anywhere on any window and you have "grabbed" that window. This is VERY handy once you get used to it and I can't switch to OS X without it...
    I've done a lot of Googling but have come up empty...
    Thanks!
    Ross

    Hi, Ross.
    If someone has developed a similar solution for Mac OS X, you are likely to fnd it by searching MacUpdate or Version Tracker. The user-submitted reviews accompanying the listings can be helpful in sorting the wheat from the chaff.
    Good luck!
    Dr. Smoke
    Author: Troubleshooting Mac® OS X

  • Windows moving spontaneously to the screen bottom - only title bar visible

    I have this odd behavior on my MBP after installing Lion.  I'll be replying to a message in Mail or moving a window in finder ... and suddenly the window disappears.  Sometimes I find it down at the bottom left of the screen, with only the title bar showing.  Other times, it will "walk" to the bottom of the screen on its own ... a "stutter step at a time," while I try in vain to stop it.
    In Mail, this will tend to happen if I start typing in the reply before the Genie has openened the message all the way.  In the Finder, it seems to happen if I move a window too quickly to the edge of a screen or across to my second monitor.
    It's slightly maddening, and a real waste of time as I watch helplessly as windows march their way to the bottom of the screen.  Any help is much appreciated.

    Hmmm ... Replying to my own message.
    After booting into safe mode, and seeing no problem, I began adding back my login items one at a time.
    It appears that the issues is with MenuEverywhere and 10.7 or 10.7.1.  Disable ME and all is well.
    I've opened a ticket with Binary Bakery.

  • Unicode in the Title bar of JFrame

    Hi
    I have a unicode application and I am using the font Arial Unicode MS. I want to show unicode charecters in the title of my JFrame. I am able to show unicode chars in all other controls except for the title of the main JFrame.
    I read several posts on the forum and came to an understanding that, the title bar of the JFrame is controlled by the OS.
    So I changed the fonts used in my windows also to Arial Unicode MS. But still I see only ??? in place of unicode characters.
    Need urgent help.
    Thanks
    Vineet

    import java.awt.*;
    import javax.swing.*;
    public class X {
        public static void main(String[] args) {
            JFrame.setDefaultLookAndFeelDecorated(true);
            JFrame f = new JFrame("ABCabcXYZxyz");
            Font font = new Font("Lucida Bright", Font.BOLD|Font.ITALIC, 14);
            Container cp = f.getContentPane();
            JLayeredPane lp = f.getLayeredPane();
            for(int i=0, ub=lp.getComponentCount(); i<ub; ++i) {
                Component child = lp.getComponent(i);
                if (child != cp)
                    child.setFont(font);
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            f.setSize(500,400);
            f.setLocationRelativeTo(null);
            f.setVisible(true);
    }1. You have to use a LAF that draws its own title bar. If your platform is drawing your title bar, you'll
    have to go the JNI route :-(
    2. If you have a menu bar, it'll be in the layered pane as well, so you'll have to skip over the way
    content pane is skipped over...

  • Custom title bar

    Hi All!
    How do I add my own title bar to a JFrame?
    I have managed to remove the default one. but I cannot figure out how to add a custom one.
    I also want to place it above the JMenuBar so adding it to the content pane will not help.
    Any advise will be welcomed.
    Thanks,
    SIJP

    My Look and feel is working just fine.
    my problem is that I can do two things:
    if I add the default title bar my l&f has two title bars and if I choose to make my look and feel have one title bar the windows L&F has no title bar at all.

  • Hiding the titleBar??? if it is the title bar

    I think it is the title bar not sure what it is called the computer teacher did not know the name nor could it be found. Umm yeah anyway I was wondering if in an awt Frame there was anyway to hide the title bar....
    I am meaning with the term title bar the bar with the title of your program the icon and the minimize full screen and exit button on it...
    Yeah just curious it would make my program look nicer if my popup window did not have this bar....
    thanks in advance

    The title bar of a window is the most obvious portion of any gui and the fact that someone that is suppose to be an instructor.. someone with knowledge to share and they are not sure of the most basic components of a GUI is shameful at best.
    And this shows in your lack of knowledge that a JFrame and a Frame are on a GUI component level the same.
    So either you have not red any documentation or your instructors knowledge is showing through you.
    The JFrame is a light weight component...... with
    all the same widnow decorations as a Frame...
    Thank U

  • On CS6  with two images in the titles and one open Tutrials tell me that I can drag one onto the greyed title and there will be 2 layers in the layer panel .I have done this many times both with unlocked layers and duplicates . None of three options work.

    In CS^ when I have 2 photos inthe title bar and one is greyed out tutorials tell me I can rag the opened photo onto the greyed title to create two images in the layer panel.  It does not wrk even if I unlock them or use duplicates. Modify keys don,t help.  What is wrong ?

    First select the Move Tool
    Drag the source picture to the tab of the destination picture
    The tab will open to reveal your destination picture, do not release the button yet, but drag the move tool onto the destination picture.
    Then release the mouse button.
    Tell me how you did.
    Gene

  • How to outline selected cells during drag and drop in the jtable

    Hi,
    I have spent a lot of time to find out how to outline selected cells during drag in the jtable, but I did not find the answer.
    Can anybody give me a tip, where to read more about this problem or even better, give an example...
    I have the following situation:
    1.Table has 10 rows and 10 columns
    2.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION) and setCellSelectionEnabled(true)
    3.user select 5 cells in 4th row (for example cell45,cell46,cell47,cell48 and cell49)
    4.user starts dragging. During dragging an outline should be drawn. Outline should be a rectangular with width of 5 cells and height of one cell. Outline should move according to the mouse position.
    5.rectangular disappears when dropped
    Regards,
    Primoz

    In "createTransferable" you can create a drag image
    which you can paint in "dragOver" and clear in "drop" method of DropTarget :
    package dnd;
    * DragDropJTableCellContents.java
    import javax.swing.*;
    import javax.swing.border.*;
    import javax.swing.table.*;
    import java.awt.*;
    import java.awt.datatransfer.*;
    import java.awt.dnd.*;
    import java.awt.event.*;
    import java.awt.image.BufferedImage;
    import java.io.IOException;
    public class DragDropJTableCellContents extends JFrame {
        public DragDropJTableCellContents() {
            setTitle("Drag and Drop JTable");
            setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            getContentPane().add(createTable("JTable"), BorderLayout.CENTER);
            setSize(400, 300);
            setLocationRelativeTo(null);
        private JPanel createTable(String tableId) {
            DefaultTableModel model = new DefaultTableModel();
            for (int i = 0; i < 10; i++) {
                model.addColumn("Column "+i);
            for (int i = 0; i < 10; i++) {
                String[] rowData = new String[10];
                for (int j = 0; j < 10; j++) {
                    rowData[j] = tableId + " " + i + j;
                model.addRow(rowData);
            JTable table = new JTable(model);
            table.getTableHeader().setReorderingAllowed(false);
            table.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
            table.setCellSelectionEnabled(true);
            JScrollPane scrollPane = new JScrollPane(table);
            table.setDragEnabled(true);
            TableTransferHandler th = new TableTransferHandler();
            table.setTransferHandler(th);
            table.setDropTarget(new TableDropTarget(th));
            table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
            JPanel panel = new JPanel(new BorderLayout());
            panel.add(scrollPane);
            panel.setBorder(BorderFactory.createTitledBorder(tableId));
            return panel;
        public static void main(String[] args) {
            new DragDropJTableCellContents().setVisible(true);
        abstract class StringTransferHandler extends TransferHandler {
            public int dropAction;
            protected abstract String exportString(JComponent c);
            protected abstract void importString(JComponent c, String str);
            @Override
            protected Transferable createTransferable(JComponent c) {
                return new StringSelection(exportString(c));
            @Override
            public int getSourceActions(JComponent c) {
                return COPY;
            @Override
            public boolean importData(JComponent c, Transferable t) {
                if (canImport(c, t.getTransferDataFlavors())) {
                    try {
                        String str = (String) t.getTransferData(DataFlavor.stringFlavor);
                        importString(c, str);
                        return true;
                    } catch (UnsupportedFlavorException ufe) {
                    } catch (IOException ioe) {
                return false;
            @Override
            public boolean canImport(JComponent c, DataFlavor[] flavors) {
                for (int ndx = 0; ndx < flavors.length; ndx++) {
                    if (DataFlavor.stringFlavor.equals(flavors[ndx])) {
                        return true;
                return false;
        class TableTransferHandler extends StringTransferHandler {
            private int dragRow;
            private int[] dragColumns;
            private BufferedImage[] image;
            private int row;
            private int[] columns;
            public JTable target;
            @Override
            protected Transferable createTransferable(JComponent c) {
                JTable table = (JTable) c;
                dragRow = table.getSelectedRow();
                dragColumns = table.getSelectedColumns();
                createDragImage(table);
                return new StringSelection(exportString(c));
            protected String exportString(JComponent c) {
                JTable table = (JTable) c;
                row = table.getSelectedRow();
                columns = table.getSelectedColumns();
                StringBuffer buff = new StringBuffer();
                for (int j = 0; j < columns.length; j++) {
                    Object val = table.getValueAt(row, columns[j]);
                    buff.append(val == null ? "" : val.toString());
                    if (j != columns.length - 1) {
                        buff.append(",");
                return buff.toString();
            protected void importString(JComponent c, String str) {
                target = (JTable) c;
                DefaultTableModel model = (DefaultTableModel) target.getModel();
                String[] values = str.split("\n");
                int colCount = target.getSelectedColumn();
                int max = target.getColumnCount();
                for (int ndx = 0; ndx < values.length; ndx++) {
                    String[] data = values[ndx].split(",");
                    for (int i = 0; i < data.length; i++) {
                        String string = data;
    if(colCount < max){
    model.setValueAt(string, target.getSelectedRow(), colCount);
    colCount++;
    public BufferedImage[] getDragImage() {
    return image;
    private void createDragImage(JTable table) {
    if (dragColumns != null) {
    try {
    image = new BufferedImage[dragColumns.length];
    for (int i = 0; i < dragColumns.length; i++) {
    Rectangle cellBounds = table.getCellRect(dragRow, i, true);
    TableCellRenderer r = table.getCellRenderer(dragRow, i);
    DefaultTableModel m = (DefaultTableModel) table.getModel();
    JComponent lbl = (JComponent) r.getTableCellRendererComponent(table,
    table.getValueAt(dragRow, dragColumns[i]), false, false, dragRow, i);
    lbl.setBounds(cellBounds);
    BufferedImage img = new BufferedImage(lbl.getWidth(), lbl.getHeight(),
    BufferedImage.TYPE_INT_ARGB_PRE);
    Graphics2D graphics = img.createGraphics();
    graphics.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f));
    lbl.setBorder(BorderFactory.createLineBorder(Color.LIGHT_GRAY));
    lbl.paint(graphics);
    graphics.dispose();
    image[i] = img;
    } catch (RuntimeException re) {
    class TableDropTarget extends DropTarget {
    private Insets autoscrollInsets = new Insets(20, 20, 20, 20);
    private Rectangle rect2D = new Rectangle();
    private TableTransferHandler handler;
    public TableDropTarget(TableTransferHandler h) {
    super();
    this.handler = h;
    @Override
    public void dragOver(DropTargetDragEvent dtde) {
    handler.dropAction = dtde.getDropAction();
    JTable table = (JTable) dtde.getDropTargetContext().getComponent();
    Point location = dtde.getLocation();
    int row = table.rowAtPoint(location);
    int column = table.columnAtPoint(location);
    table.changeSelection(row, column, false, false);
    paintImage(table, location);
    autoscroll(table, location);
    super.dragOver(dtde);
    public void dragExit(DropTargetDragEvent dtde) {
    clearImage((JTable) dtde.getDropTargetContext().getComponent());
    super.dragExit(dtde);
    @Override
    public void drop(DropTargetDropEvent dtde) {
    Transferable data = dtde.getTransferable();
    JTable table = (JTable) dtde.getDropTargetContext().getComponent();
    clearImage(table);
    handler.importData(table, data);
    super.drop(dtde);
    private final void paintImage(JTable table, Point location) {
    Point pt = new Point(location);
    BufferedImage[] image = handler.getDragImage();
    if (image != null) {
    table.paintImmediately(rect2D.getBounds());
    rect2D.setLocation(pt.x - 15, pt.y - 15);
    int wRect2D = 0;
    int hRect2D = 0;
    for (int i = 0; i < image.length; i++) {
    table.getGraphics().drawImage(image[i], pt.x - 15, pt.y - 15, table);
    pt.x += image[i].getWidth();
    if (hRect2D < image[i].getHeight()) {
    hRect2D = image[i].getHeight();
    wRect2D += image[i].getWidth();
    rect2D.setSize(wRect2D, hRect2D);
    private final void clearImage(JTable table) {
    table.paintImmediately(rect2D.getBounds());
    private Insets getAutoscrollInsets() {
    return autoscrollInsets;
    private void autoscroll(JTable table, Point cursorLocation) {
    Insets insets = getAutoscrollInsets();
    Rectangle outer = table.getVisibleRect();
    Rectangle inner = new Rectangle(outer.x + insets.left,
    outer.y + insets.top,
    outer.width - (insets.left + insets.right),
    outer.height - (insets.top + insets.bottom));
    if (!inner.contains(cursorLocation)) {
    Rectangle scrollRect = new Rectangle(cursorLocation.x - insets.left,
    cursorLocation.y - insets.top,
    insets.left + insets.right,
    insets.top + insets.bottom);
    table.scrollRectToVisible(scrollRect);
    Edited by: Andre_Uhres on Nov 18, 2007 10:03 PM

  • PS CS5 messes up menu bar; dialog boxes distort during drag; etc

    I'm having weird problems with Photoshop CS5.  I'd love help, or even tips for how to frame the question when searching for help.
    Here are the symptoms:
    - After starting PS, if I open any dialog box and then close it, after closing the PS menu bar is corrupted -- it looks like a single row of pixels is missing through the File, Edit, Image, etc words, and at the right end of the menu bar, the three control icons are overlain with Windows control icons.  Both these problems can be seen in the screen capture image below.
    - When a dialog box is open, if I drag it around, it gets clipped as repainting tries to keep up with the mouse.  It's always rectangular, but edges flicker off to varying depths as it repaints to move.  When the mouse stops, the repaint works and it looks fine.  While moving, the faster the movement, the worse the effect.
    - When using tools such as Lasso select, the movement feedback (the selection gray line) lags a few millimeters or more, depending on speed.
    To me it looks like an application + video driver problem, but all s/w is up to date.  Messing with OpenGL setting (Edit->Preferences) doesn't affect things; it acts the same with OpenGL on or off, basic, normal, or advanced.  My video card is displayed correctly in the Edit->Preference: Performance box.
    The first problem (menu bar corruption) is obviously least interfering and I believe has been with me longest.  The latter two problems make PS somewhat difficult to use, and I believe showed up in the last few months (since the last time I used PS intensively, about 8 months ago).  I can't recall for sure, but I think I installed updates to both PS and ATI drivers in the last 8 months (ie., so both could be suspects).
    Any ideas what is wrong, or what to search for?  What would be a good search query for this sort of problem set?
    Does this seem to be an Adobe problem, or ATI, or who?
    Here's my set-up:
    - Dell Inspiron 580 with 6 GB RAM
    - ATI Radeon HD 5450
    - Windows 7 64-bit
    - PS CS5 standard edition
    Thanks for help and/or ideas!

    I don't know about pre-packaged themes, but what I do is along these lines:
    Minimize Chrome on the Desktop
    If you have a sharp monitor, good eyes, and don't like that Microsoft has made all the useless chrome and border space around everything larger in the later versions of Windows, you'll likely want to minimize it to make more room to do real work...
    ·    Right-click on Desktop - Personalize, ensure the Windows 7 Aero theme is selected
    ·    Choose Window Color – Advanced appearance settings...
    ·    Active Title Bar item to size 17.
    ·    Menu item to Size 15, font Segoe UI size 8.
    ·    Border Padding item to size 0.
    ·    Scroll Bar item to size 16.
    ·    Caption Buttons item to size 16.
    ·    Icon Spacing (Horizontal) item to size 27.
    ·    Icon Spacing (Vertical) item to size 41.
    You can experiment with these settings to find a balance you like.
    Hope this helps!
    -Noel

  • Can i use iCloud keychain with my own passwords and not with what is assigned and stored?

    Can i use iCloud keychain with my own passwords and not with what is assigned and stored?

    tammersalem wrote:) <-HDMI-> (HDTV)
    My main concerns are:
    -If I use iTunes on my main computer, will it then be available to Apple TV?
    -If I use Apple TV to download will it be available to my Main computer?
    -Can the Apple TV use a media server for storage over LAN (using NTFS Samab or otherwise)?
    Basically iTunes feeds AppleTv with media either syncing (copying to it) or streaming live.
    Media must be compatible with AppleTV.
    AppleTV requires a proper iTunes instance running - it cannot access a NAS directly.
    If you store media in a folder on a NAS and it's part of the computer iTunes library (just stored on the NAS vs internal/external drive), then when running iTunes makes this content available to AppleTV.
    Data will travel:
    NAS > network > iTunes > network to AppleTV
    As the path is potentially slower than internal/external attached drive > iTunes > network > AppleTV, it may or may not work robustly for streaming.
    If AppleTv is set to sync (it can also stream in this mode), when you purchase direct on AppleTV, the media should sync back to where the itunes library is stored (via iTunes) to keep things in sync and to allow you to backup the media.
    You cannot drag/drop media to/from AppleTv across the network, nor can it directly access storage itself - iTunes is an essential cog in the wheel.
    The majority of commercial 'in-built iTunes media servers' will not work directly with AppleTV as it has to be 'paired' with iTunes by entering a numerical code in iTunes and does not simply see 'shared libraries'.

  • 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);

  • Pages templates how replace given info with my own?

    Question: I'm trying to use a business card template. Have replaced the 'holding info' with my own wording in upper left section: now want this info to be repeated in all other sections on page: how to do this?

    Pages 5?
    You copy the first corrected business card and paste it in the other cards. You can use Cpoy and Paste, Option  + drag or use Cmd + d to duplicate the first card.

Maybe you are looking for

  • Getting 10.4 onto a G3 iMac w/o DVD drive

    So I'm having some Tiger taming trouble. I've been quite happy with my G4 iBook since I bought it; Tiger came with it, and I haven't made the Leopard leap, so it's running 10.4.11 with all current updates. I still have my old G3 iMac (Summer 2001 "Ki

  • Urgent!! Please help - Issue related to JIntegra

    Hi, We were using JIntegra that comes with weblogic server (in weblogic.jar file) to connect to a DCOM server. It works fine with weblogic 7.1. We have recently moved to weblogic 8.1. We haven't changed any code, configuration related to JIntegra but

  • To ragnic and other about Singleton class

    Hi ragnic. Thanks for your reply. I posted the code wrong. Heres' my correct one. I have a GUI first loaded information and the information is stored in a databse, I have some EJB classes..and my singleton class ABC has some method to access to the E

  • Easy Question: Copy pcui_gp/xssfpm from DTR track to local development

    Hi Experts, I have to create one custom Web Dynpro program in Local Development. For this program, pcui_gp/xssfpm and pcui_gp/xssutils are needed. NWDI is configured. I can see pcui_gp/xssfpm and pcui_gp/xssutils in one of the DTR tracks. I am not al

  • SDK v3.0 Compatible with 2.4

    Just starting to look into LR plug-in work. I'm still on LR v2.4. My question is whether the currently available SDK 3.0 for LR would be backwards compatible with LR 2.4, or do I need a 2.x SDK (and if so, where could I find that).