JavaFX 2.0 :: Keep Last Button Pressed With Custom Style

Dec 27, 2014

I have a VBox with 20 buttons and I have this style applied (menu.css) (only for VBox wrapper):
 
.button:focused {
    -fx-background-color: #0768A9;
    -fx-text-fill: #FFFFFF;
}

But when I pressed other button outside the VBox the style disappears, because the other button get the focus.

How I can do to keep the last button pressed with a custom style? (Only for buttons containing the VBox).

View Replies


ADVERTISEMENT

JavaFX 2.0 :: Remove Style From Component?

Oct 28, 2014

I am using the Javafx 8 Date Picker. Its works fine. I have defined a stylesheet for my application and in that style sheet i have a style for Button. I apply this style to the every scene. Now my question is: When I use the datepicker and I click on the calendar icon, the datepicker popup appears and the left and right arrows adjacent to month and year fields in the seems to pick the style of the button class from style sheet defined in my application., Is there a way to avert this and tell datepicker to use default styles and not the styles defined my application.
 
I tried removing the style at runtime from the scene, but of no use.

View Replies View Related

JavaFX 2.0 :: Style Column Like Header In TableView

Jul 5, 2014

I have a column of my TableView that just shows row numbers, and I would like to style the cells in that column so that they appears just like a column header (so the same styling as the headers use). I presume there is some simple way to do this by tapping into the right style class, but I am not sure which one.

View Replies View Related

How To Get JList To Update When Refresh Button Pressed

Mar 15, 2015

I am able to update the array holding the items but I don't know how to refresh the JList to include all the new items in the array.

Code for GUI:

import java.awt.ScrollPane;
import java.awt.event.ActionListener;
import javax.swing.*;
public class ListView extends JFrame{
HobbyList stuff = new HobbyList();

[Code] .....

View Replies View Related

Change Text In JLabel When Button Pressed

Dec 4, 2014

Ok, so I am trying to learn about JFrames and JPanels. I have figured out buttons, layouts, etc. What im having trouble with is accessing the label object from the ButtonHandler class since it is static and I need my JLabel to be non-static so that it can change. Basically, I want JLabel to change to a pre-determined text string once a button is pressed. Here's what I have so far

package makewindow;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;

[code]....

View Replies View Related

Classing White Space As Invalid Name When Close Button Is Pressed

Oct 29, 2014

I have a filechooser that works how it should and if anyone enters anything with a dot that isnt .xml it shows an invalid file name message. However when I dont choose a file and press cancel it still says that because when my boolean hits false it's the first thing it hits in that section of code.

if(!writeSuccess)
{
//display output messages in JOptionPane
JOptionPane.showMessageDialog(null,"Error, file name invalid", "Error", JOptionPane.ERROR_MESSAGE);
} else {
JOptionPane.showMessageDialog(null,"Export successful", "Success", JOptionPane.INFORMATION_MESSAGE);
//close the form
me.dispose();
}

If I want it to just close down without it saying anything is there sort of if statement I could do that would prevent this? But if it is an invalid file name it will still show that message?

View Replies View Related

Applets :: Accessing External Resources - Play Particular Sound Whenever Button Is Pressed

May 4, 2014

I am quite new to developing Applets in java. I recently made an applet that will play a particular sound whenever a button is pressed. The sound files are placed in the same directory as the applet class file and i access them by using

AudioClip clip=getAudioClip(getCodeBase(),"A.wav").

The Applet runs fine in the appletviewer but whenever I try to open it using any browser like Chrome,IE,Firefox the applet loads but sound isn't played. I checked the java console and it showed

"java.security.AccessControlException: access denied ".

My questions are:

1. How do I allow the applet to get access to those files?

2. When the Applet is running from the local file system why CAN NOT I access those resources via getCodeBase() ???

3. I googled and found that I can sign a JAR and that can have full access to the computer. But how do I create a JAR from an applet (which has no Main method) while it asks me to point to the main class in the manifest?

View Replies View Related

Loading JPanel From Another JPanel When Button Is Pressed

Jun 9, 2014

I am making a game in java and i want to make a title screen. What I am trying to do is make a jpanel and load another jpanel when a button is pressed in one of the japenls. Here is the code for the runner

import java.awt.BorderLayout;
import javax.swing.JFrame;
public class Runner extends JFrame {
// Have these set up so they can be seen everywhere
public static final int GAMEWIDTH = 540;
public static final int GAMEHEIGHT = 710;
static boolean loading = false;

[Code] ....

here is the code for the jpanel that loads the other jpanel

import java.awt.Color;
import java.awt.FlowLayout;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.Rectangle;

[Code] ...

How do load a jpanel when a button is pressed in another jpanel

View Replies View Related

JavaFX 2.0 :: TreeItem And Custom Rendering

May 31, 2014

I am fairly new to FX but well experienced with Swing. Since I am familiar with the Swing concept of rendering a let's say JTree I got problems with the FX model of - in this case - TreeView.
 
I read several documentations about FX. From the API doc of TreeItem I adapted the file browser example to create an own class like this :
 
public class PathTreeItem extends TreeItem<PathTreeItem> implements
        Comparable<PathTreeItem> {
    private boolean firstVisit = true;
    private boolean readable;
    private boolean dir;
    private boolean symlink;

[Code] ...
 
But this did not change anything. I try to override toString() in both classes but even this did not change anything.
 
What I wonder so far:
 
Why is item in PathNodeTreeCell always null?What is the difference between the item I get in the updateItem method and the one I get from getItem() (line 10)How can I connect the PathTreeItem class to the PathNodeTreeCell classShould I always call super() in the constructors? (I delved a little bit in the sources of TreeItem and TreeCell and I found some setup code there )Is it ok to extend TreeItem in the way I does for my custom PathTreeItem class? ( I wonder if this is a cyclic dependency when I extends TreeItem in this way )How can I sort the nodes? I added the Comparable interface but this not change the sorting of the nodesAre ther some tutorials of TreeItem/TreeCell with no trivial objects like String ? 

I want to adapt an well running Swing application to FX. In the Swing app I used a mechanism to load the child path's of a directory in a separate thread to avoid freezing if the UI if there are much child elements. I guess in FX I should use the Properties pattern to achieve this should I?

View Replies View Related

JavaFX 2.0 :: Custom Icons Into Bundle DMG Package

Jul 21, 2014

I created an ant script to create an installer for my JavaFx app:
 
<?xml version="1.0" encoding="UTF-8"?>
<project name="app-javafx" default="do-deploy" basedir="." xmlns:fx="javafx:com.sun.javafx.tools.ant">
    <property name="java8.jdk.home" value="/Library/Java/JavaVirtualMachines/jdk1.8.0_11.jdk/Contents/Home" />
    <property name="javafx.tools.ant.jar" value="${java8.jdk.home}/lib/ant-javafx.jar" />
    <target name="init-fx-tasks">

[Code] .... 

During compiling I see:

Using base JDK at:

/Library/Java/JavaVirtualMachines/jdk1.8.0_11.jdk
  Using default package resource [Bundle config file] (add package/macosx/Info.plist to the class path to customize)
  Using default package resource [icon] (add package/macosx/app.icns to the class path to customize)
Creating app bundle: /Users/Utente/Documents/workspaceServer/javafx/target/deploy/bundles/app.app
Config files are saved to /var/folders/q6/vmt_h0tx3rgdbt_4h2_2f3780000gn/T/build6635061168386632777.fxbundler/macosx.

Use them to customize package.
fxbund
ler/macosx. Use them to customize package.
 
So I get files inside the temp directory and I copied them inside my project target directory. Unfortunally javafxbuilder don't use them to customize the package so I think the path where I have to put that files is wrong.

View Replies View Related

JavaFX 2.0 :: Continuous Drawing In Custom NGRegion

Jul 15, 2014

I am subclassing a Pane to be able to use my custom NGRegion:
 
public class MyPane extends Pane {
@Override
public NGNode impl_createPeer() {       
return new MyNGRegion();
}
}
 
in MyNGRegion i override renderContent(Graphics g) for custom drawing
 
@Override
protected void renderContent(Graphics g) {
/* custom drawing */
}
 
The custom NGRegion gets drawn one time, but i want to continuously draw on every pulse.
 
i already tried a lot of things, but don't see how to do it properly:
 
using -Dprism.forcerepaint=true did not work.

overriding clearDirty() and set it

View Replies View Related

JavaFX 2.0 :: SceneBuilder Custom Types (not Node Derived)

Sep 24, 2014

Adding Node derived objects to SceneBuilder is easy and works fine.
 
I'm wondering how to add non-Node derived objects. It seems to be possible as MenuItem derived objects are listed and can be used.
 
How to add custom types (not Node derived) to SceneBuilder?

View Replies View Related

JavaFX 2.0 :: Custom ComboBox Implementation Not Recognized By Scene Builder 2.0

Jun 3, 2015

I did an implementation which is an extension of javafx.scene.control.ComboBox

Inside I imported the Class ComboBoxListViewSkin

import com.sun.javafx.scene.control.skin.ComboBoxListViewSkin;
 
I think this might be the reason as this comboBox is not recognized at the import to the scene builder library. I can show up the import dialog of custom controls, but my custom ComboBox is not showing up. All other implementations are there correctly as they are loaded from my customControl.jar file
 
I use the ComboBoxListViewSkin for the functionality to scroll to an item in the combo as a user types a letter on the keyboard.

I do this by:

/**
     * This method scrolls the itemView of the items to the first item starting
     * with the given char or string
     *
     * @param pressedKey
     */
    public void scrollToChar(String pressedKey) {
        String value = pressedKey.toUpperCase(); 
        for (Object userEntry : getItems()) {

[Code] ....
 
I really need to show up my custom Combo in the scenebuilder, as otherwise the rest of my fxml is not editable in sceneBuilder 2.0 ....

View Replies View Related

JavaFX 2.0 :: No Tooltip In Custom Control Allowed - Cannot Be Imported To SceneBuilder?

May 21, 2014

If I use an instance of Tooltip in my custom-control, it can not be imported to SceneBuilder any more. Using Tooltip in my custom-control skin works - is that the way it is supposed to be?
 
Background: I have a control (ValidatedTextField) which uses Tooltips to inform about unwanted characters. It works in SceneBuilder1.x.

SceneBuilder 2 does not "accept" this control unless I take out all Tooltips. I have verified this behavior with some other working controls.
 
I have found a workaround to use the Tooltip in the Skin.

View Replies View Related

JavaFX 2.0 :: How To Open PDF On Button Click

Jul 15, 2015

I'm using java FX-8 and JDK 1.8,Netbeans 8.0.2.I want to open pdf on button click in my JavaFXML Application.I have triued pdf viewer plugins and iText but it doesn;t work.I have to pass variable value in pdf too.

View Replies View Related

JavaFX 2.0 :: Button Label Cutoff

Jan 9, 2015

I have a button whose text is being cutoff. How can I tell javafx that the button should be as big as the text in it and so no cutting off text happens?

View Replies View Related

JavaFX 2.0 :: Add Node To The Pane Of Button

Mar 9, 2015

I want to have a button that will include another node beyond the text and image that are part from the Button. This node as example will be a circle that I will change his color from gray to green if the button was pushed.

I try to do this with Background / BackgroundFill with no success

I tried to get access to the Pane / Region of the Button, but I can't find a way to do it.

View Replies View Related

JavaFX 2.0 :: Button Is Not Fired On Enter Key

Sep 3, 2014

With the switch of the JVM version in our project, it turned out that the default behavior of Button has changed from JavaFX 2.2 to JavaFX 8. The button action is not fired on pressing the Enter key, only on pressing space.
 
Sample:

public class ButtonTest extends Application
{
    @Override
    public void start(Stage primaryStage) throws Exception
    {
        Button l_button = new Button("Hit me");
 
[Code] ....

Run the sample Application in Java 7 with JavaFX 2.2: both pressing Enter and Space print "auau" to the console if the button is focused.

Run the sample Application in Java 8: only pressing Space prints "auau"
 
How can this be? Hitting a focused button on Enter is a standard behavior on Windows platforms.

View Replies View Related

JavaFX 2.0 :: Button With Menu And Multiple Choice?

Oct 9, 2014

in javafx, how can i implement a composant as shown in the following figure. when i click in the arrow, i must have a menu allows me to do a multiple choice like shown in  figure

View Replies View Related

JavaFX 2.0 :: Create Button Bar The Same As Confirmation Dialog

May 1, 2015

I want to create a button bar that is the same as the confirmation dialog button bar -- so an OK and cancel button layed out in the platform specific way, and with the same styling.
 
I have made some progress via a hack -- create an alert dialog, and extract the buttons in the dialog using lookupButton, and then put those buttons in a toolbar. But this doesn't necessarily get a toolbar with the buttons in the correct order. If I could get the button bar out of an alert dialog I would have a solution, but I can't see to do that.

View Replies View Related

JavaFX 2.0 :: Select Tree Node On Button Click

Jun 20, 2014

I want to develop simple example in which I can select TreeView Nodes with Buttons(in some cases clicking on image and etc). I created this simple sample:
 
<pre style="" _modifiedtitle="true" jivemacrouid="_14032555963537721" ___default_attr="java" jivemacro="code" class="jive_text_macro jive_macro_code jivemacrouid_14032555963537721">
import javafx.application.Application;
import static javafx.application.Application.launch;
import javafx.geometry.Insets;

[Code] .... 
 
The question is how I can select tree Node when I click on a button. For example when I click on a button Item A1 I want to select tree idem Item A1.

View Replies View Related

JavaFX 2.0 :: Cannot Set Divider Positions In Multiple Splitpanes At One Button Click

May 29, 2014

I have a problem with setting multiple splitpane divider positions. In my application there are multiple splitpanes (one inheriting the other). When resizing the scene (e.g. by double-click or mouse drag) the divider position default values (as set in the FXML) are not taken into account and the application therefore incorrectly displays the divider positions. For example, one pane that should be only 100px wide now spans over the half of the application. Its not very nice because one has to readjust the divider positions manually each time after resizing the window. At the same time, I dont want to set maximum values to keep the layout flexible.
 
I tried to solve this by adjusting the divider positions at a button click event (..setOnAction(new EventHandler<ActionEvent>()...) but when I click it only one splitpane at a time is adjusted. As I have 3 splitpanes I have to click the button 3 times to get all the adjustments. I am not sure whether this is because the click event is consumed after the first adjustment and subsequent repaint of the scene?
 
A sample code of what I have now would look like this:
 
adjustButton.setOnAction(new EventHandler<ActionEvent>(){
public void handle(ActionEvent e){
     pane1.setDividerPositions(0.9);
     pane2.setDividerPositions(0.8);
     pane3.setDividerPositions(0,075);
      }
});

View Replies View Related

Allman Style For Eclipse

Jan 25, 2012

I just started Java programming bout 3wks ago and using jGrasp since then. But ive started using eclipse and just wondering if it can be set up to use allman style? I dont like having to use tab and backspace to get my brackets in line and neat. I decided to ask before i went snooping around the settings and mess something up since im not to familiar with it right now.

View Replies View Related

Style Preferences For Conditional Returns?

Oct 21, 2014

I have a routine that returns a boolean. If any of a series of tests fails, the routine returns false, otherwise it returns true. For example, the routine might test for whether or not an integer is both odd and greater than 99, thus:

public boolean oddAndOld(int x)
{
if (x % 2 == 0)
return false;
if (x < 100)
return false;
return true;
}

I like the above because it suggests that "true" is the condition that applies if the incoming parameter meets all the required criteria. But I've sometimes seen this style used:

public boolean oddAndOld(int x)
{
if (x % 2 == 0)
return false;
if (x < 100)
return false;
else
return true;
}

I like this less because, among other things, if that last criterion is removed, the "else/return true" must be moved up into the immediately preceding test (or else leave some funny whitespace, depending on how you go about removing the departing "if" statement), but it does avoid suggesting that "return true" is hard-coded (that is, it reinforces that "true" is a conditional return value, not inevitable).

View Replies View Related

Font Style Constants To String Is It Possible?

Jan 20, 2014

The Font style constants are of int: int[] fontStyleList = new int[] {Font.PLAIN, Font.BOLD, Font.ITALIC};But what do I do when I want to add the names such as PLAIN etc. as the name of a menu item?

The following is not going to work, right!String[] parts = (fontStyleList[i].toString()).split("."); or String[] parts = ("" + fontStyleList[i]).split(".");rbStyle = new JRadioButtonMenuItem(parts[1]);

Is there another way to do this or should I just do another array with the names as a String?

View Replies View Related

How To Separate Single Calculator Class (OOP Style)

Sep 5, 2014

I've been into java for about 4 months now, No complaints so far, it's pretty awesome! So I understand Polymophism pretty good, I did some Animal classes and it worked out neatly.

However. I just can't seem to find my way in OOP when trying to implement in on a Calculator Class I wrote. As you mind know, a calculator can be separated into many classes. But I actually just want it to be separated into some OO like: | Calculator | CalcGUI | CalculatorFunctions | CalcRun.

I tried separating the single Calculator class, however, my calculator Buttons didn't work after that, anymore..

here is my code:

import java.awt.GridLayout;
import java.awt.Panel;
import java.awt.TextField;
import java.awt.Button;
import java.awt.Menu;

[Code] ....

View Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved