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?
endang

JProgressBar? 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();

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 Agarwal

    Set 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.
    Rainer

    Not sure, but this thread might help:
    http://forum.java.sun.com/thread.jsp?forum=57&thread=340326

  • Progress bar in a JProgressBar component is not always drawn

    Hi experts,
    I have a strange issue with a swing application. This app contains of a JFrame including a JTable. This table has multiple columns, one of them is a JProgressBar (implementing a TableCellRenderer). Multiple background threads are running, every of them updates one row's progress bar via the InvokeLater() method. This works fine.
    At a specific point within the runtime of the application, the value of a progress bar is set back to 0, and instead of the default percentage text a custom string is displayed (then continuing to progress with this custom text set). This works fine as well.
    Problem is, that when a custom string is set to one progress bar as described above, then the bars of the other JProgressBars are not painted any more. But the default percentage text of these other JProgressBars are still incremented and painted correctly. When the one progress bar, that has the custom string set, has finished and this row is removed from table, then the other progress bars are again painted correctly (including the default percentage text).
    A part of the custom TableCellRenderer class is shown here:
         public class ProgressRenderer extends JProgressBar implements TableCellRenderer
         public ProgressRenderer()
              super(SwingConstants.HORIZONTAL);
              setBorderPainted(false);
              setStringPainted(true);
         public Component getTableCellRendererComponent(JTable table, Object value,
              boolean isSelected, boolean hasFocus, int row, int column)
              if(value != null)
                   setValue(((JProgressBar) value).getValue());
                   setString(((JProgressBar) value).getString());
                   setMinimum(((JProgressBar) value).getMinimum());
                   setMaximum(((JProgressBar) value).getMaximum());
              return this;
    ...Any ideas what could be wrong here?
    I am really out of ideas here :(
    Thanks in advance for your help!
    Kind regards, Matthias

    I have solved the problem:
         public Component getTableCellRendererComponent(JTable table, Object value,
              boolean isSelected, boolean hasFocus, int row, int column)
              if(value != null)
                   setString(((JProgressBar) value).getString());
                   setMinimum(((JProgressBar) value).getMinimum());
                   setMaximum(((JProgressBar) value).getMaximum());
                   setValue(((JProgressBar) value).getValue());
              return this;
         }

  • 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,
    KK

    Try 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,
    Huy

    To 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

  • 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?

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

  • 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,
    Bob

    Have 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.

  • Rotation Problem... I need it to stay positive!!

    Hello everyone. I think what I have on my hands is a little
    trigonometry problem but I'm not sure because I never listened in
    math class.
    Here is the file I am referencing:
    http://pixel8media.com/help/index.html
    I'm trying to make the yellow arrow rotate from it's current
    position to the top position. Right now what I have going on is
    when the yellow arrow button is clicked it sets a variable to the
    rotation position that i want it to go to... that is the 330 number
    you see when the button is clicked. The other number shows the
    rotation of the arrows. The problem is that the rotation variable
    goes from 0-179 and then suddenly switches to a negative number and
    goes from -179 through -1 and this is throwing off the script that
    is rotating the arrows. Ahhhh!!!! hard to explain sorry. Here is a
    link to download the fla files:
    http://pixel8media.com/help/Archive.zip
    Can someone please help?
    Thanks in advance for your time

    use a variable to indicate the rotation you want. that
    variable can vary however you want.

  • 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
    swissManu

    Hi,
    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).

  • [Solved] Rotation in KDE

    I'm running into a bit of a problem with Rotation option and KDE. I set Rotation to CW in xorg.conf. When I restart the xserver, the screen is appropriately rotated. After I login, during the initial KDE boot sequence the screen stays rotated and at the right resolution, but right after it switches to still rotated position, but to the resoltuion of 1024x768 (which makes it too short vertically, and extend past the screen horizontally (with monitor rotated)). Basically, it seems that KDE is trying to override xorg's settings at some point. Does anyone have any idea where it happens, and how I can fix it?
    Thanks.

    Duh. Figured it out, right after submitting the post. I had krandrtray running which as soon as initialized was overriding xorg's settings. Problem solved, sorry about the redundancy (maybe it helps somebody in the future).

  • Rotating entire JFrame to simulate portrait mode

    Hi
    I need to rotate the entire jframe into portrait mode.
    I cannot use the graphics chip, or linux graphics device manger to change the rotation CW 90 degress - due to hardware design and limitation.
    So basically, I have to render the graphics myself, quite easily done with fllowing code at the the top level panel.
    protected void paintComponent(Graphics g)
    // center of rotation is center of the panel
    Graphics2D g2d =(Graphics2D)g;
    int xRot = this.getWidth() / 2;
    int yRot = this.getHeight() / 2;
    g2d.rotate(Math.toRadians(-90), xRot, yRot);
    super.paintComponent(g);
    This does the job nicely, however the screen is still using landscape co-ordinates, and hence when clicking on the swing components they are in the pre-rotation position.
    I have looked and cannot find, is there a simple way to switch a jframe into portrait mode. If not, is there a simple way to intercept the screen coordinates and translate the mouse coordinates to the appropriate JComponent?
    thanks in advance
    Steve

    import java.awt.*;
    import java.awt.event.*;
    import java.awt.font.*;
    import java.awt.geom.*;
    import java.util.ArrayList;
    import java.util.List;
    import javax.swing.*;
    public class TransformPoints extends JPanel {
        List<PointStore> list = new ArrayList<PointStore>();
        AffineTransform at = new AffineTransform();
        String s = "Hello World";
        protected void paintComponent(Graphics g) {
            super.paintComponent(g);
            Graphics2D g2 = (Graphics2D)g;
            g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                                RenderingHints.VALUE_ANTIALIAS_ON);
            Color color = g2.getColor();
            drawPoints(g2);
            g2.setPaint(color);
            FontRenderContext frc = g2.getFontRenderContext();
            Font font = g2.getFont().deriveFont(36f);
            Graphics2D copy = (Graphics2D)g.create();
            copy.setFont(font);
            LineMetrics lm = font.getLineMetrics(s, frc);
            float height = lm.getAscent() + lm.getDescent();
            float width = (float)font.getStringBounds(s, frc).getWidth();
            int w = getWidth();
            int h = getHeight();
            System.out.printf("w: %d  h: %d%n", w, h);
            float x = (w - width)/2;
            float y = (h - height)/2 + lm.getAscent();
    //        copy.rotate(-Math.PI/2, w/2, h/2);
            at.setToRotation(-Math.PI/2, w/2, h/2);
            copy.transform(at);
            copy.drawString(s, x, y);
            // draw some reference lines
            copy.setPaint(Color.pink);
            copy.draw(getBounds());
            copy.drawLine(w/2, 0, w/2, h);
            copy.drawLine(0, h/2, w, h/2);
            copy.dispose();
        private void drawPoints(Graphics2D g2) {
            for(int i = 0; i < list.size(); i++) {
                PointStore store = list.get(i);
                Point p = store.loc;
                g2.setPaint(Color.blue);
                g2.drawString(store.viewLoc, p.x+3, p.y);
                g2.setPaint(Color.red);
                g2.drawString(store.xformLoc, p.x+3, p.y+12);
                g2.fill(new Ellipse2D.Double(p.x-1.5, p.y-1.5, 4, 4));
        public static void main(String[] args) {
            TransformPoints test = new TransformPoints();
            JFrame f = new JFrame("click me");
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            f.add(test);
            f.setSize(500,300);
            f.setLocation(100,100);
            f.setVisible(true);
            test.addMouseListener(test.ml);
        private MouseListener ml = new MouseAdapter() {
            public void mousePressed(MouseEvent e) {
                Point p = e.getPoint();
                String viewStr = String.format("[%d, %d]", p.x, p.y);
                Point2D.Double xp = getInvertedPoint(p);
                String xfStr = String.format("[%.1f, %.1f]", xp.x, xp.y);
                list.add(new PointStore(p, viewStr, xfStr));
                repaint();
            private Point2D.Double getInvertedPoint(Point2D p) {
                Point2D.Double xp = new Point2D.Double();
                if(at.getDeterminant() != 0) {
                    try {
                        at.inverseTransform(p, xp);
                    } catch(NoninvertibleTransformException  e) {
                        System.out.println("invert error: " + e.getMessage());
                return xp;
    class PointStore {
        Point loc;
        String viewLoc;
        String xformLoc;
        public PointStore(Point p, String view, String xform) {
            loc = p;
            viewLoc = view;
            xformLoc = xform;
    }

Maybe you are looking for