Swing/AWT/SWT :: JMenuItem Disable On Load?

Oct 10, 2014

I want to disable one of the JMenuItem on load itself but when i tried with following code it is disabling after I selected the JMenuitem.

what additional changes are needed to make it work accordingly.

this.onOffItem = new JMenuItem("Filter");
this.onOffItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
applyTruthFlag(currentBTE.isTruthFlag());
}
});
this.menuFilter.add(this.onOffItem);
private void applyTruthFlag(boolean truthAuswertung) {
this.onOffItem.setEnabled(truthAuswertung);
//this.onOffItem.repaint();
}

View Replies


ADVERTISEMENT

Swing/AWT/SWT :: How To Disable Resizing Of Jframe

Feb 7, 2014

I want my jrame should not be resized when clicking on maximize button of window.and for this i have put setResizable(false)in the constructor of class which extends Jframe.

View Replies View Related

Swing/AWT/SWT :: How To Disable Entire Jpanel And All Its Contents

Oct 23, 2014

I'd like to enable/disable a jpanel and it's entire contents in one fell swoop. I could of course call each component's .setEnabled() method, but I figured there must be a better way!

View Replies View Related

Swing/AWT/SWT :: Disable Sorting By Clicking On JTable Headers

Nov 18, 2014

Is there a way to disable sorting by clicking on the JTable headers?I have tried a few ways but because I am sorting the data when I load it that 'breaks' that also. Here is what I am trying to achieve.

Sort by 3 columns:

table.setAutoCreateRowSorter(true);
table.getRowSorter().toggleSortOrder(6);
table.getRowSorter().toggleSortOrder(7);
table.getRowSorter().toggleSortOrder(5);
table.getRowSorter().toggleSortOrder(5);

but then I want it so the user cannot resort that when the table is displayed..

View Replies View Related

Swing/AWT/SWT :: Disable Event While Performing Long Running Task

Apr 28, 2015

I have in my application a button that when it is pressed, runs a long running task (usually takes a couple of seconds....).

My problem is that while the task runs, I want to stop the button from receiving clicks. Unfortunately this is something I have not achieved.

I have tried creating a new thread and calling the long running method, and using the Display.geCurrent().asyncExec...

Examples of what I have tried so far:

myButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
if (myList.size() > 0) {
myButton.setEnabled(false);
myButton.setGrayed(true);

[Code] .....

In both cases, while the button is disabled and the cursor busy, if the user clicks the button, the long running method is ran several times - and this is what I want to avoid.

View Replies View Related

Combining JMenuItem And KeyListener

Jun 9, 2014

I have a JMenuItem "Find" in the Edit Menu. I want to add a shortcut key to the JMenuItem.

For Find for example i want to use Ctrl + F

Here is my 'Action' for 'Find' which can be used via Edit->Find. It works.

Find = new AbstractAction(){
public void actionPerformed(ActionEvent e){ 
String word = JOptionPane.showInputDialog(new MainWindow(),"","Find",PLAIN_MESSAGE);
new WordSearcher(textArea,word);
}
};

WordSearcher() is a class i am using to search the word

Now i want to add a KeyListener for ctrl+F, for doing the same purpose. Even this one works.

private KeyListener k1 = new KeyAdapter()
{
public void keyPressed(KeyEvent e)
{
if(e.isControlDown())

if(e.getKeyCode()== KeyEvent.VK_F)

[Code] ....

But the problem here is i have to write the same code twice. Is there some way by which I can Use the already written Action Find in the KeyListener.

View Replies View Related

Swing/AWT/SWT :: How To Load Image To JFrame

Jul 23, 2014

How to load an image to a swing application?? I want to load it to myframe(JFrame)..

View Replies View Related

How To Disable USB Port In Netbeans (Java)

Dec 3, 2014

If this is the C Programming codes for disabling the USB port:

system("reg add HKEY_LOCAL_MACHINESYSTEMCurrentControlSetSer vicesUSBSTOR /v Start /t REG_DWORD /d 4 /f");

How can I use the codes below in Java using Netbeans?

View Replies View Related

JSF :: Enable / Disable One Inputmask Out Of Two In PrimeFaces

Jul 28, 2014

I am developing one form in jsf/primefaces. I have two inputText(inputMask) for e.g moble number and telephone number. I want to restrict the user to put only one of these two fields . That means if user starts putting value in mobile no. then telephone no. field should be disabled and if user starts putting value in telephone no. then mobile no. field should be disabled.

how should I do this.

View Replies View Related

Enable / Disable JPanel And Its ComboBoxes

Sep 11, 2014

I have a class that extends JFrame, within that, i have set up JPanel where within that i have four JComboBoxes, I am to enable this JPanel and its JComboBoxes at the end of a method

The code for that method is:

private void tableNumberJComboBoxItemStateChanged() {
// load data for table
try {
// get data for table
myResultSet = myStatement.executeQuery("SELECT * FROM"
+ "restauranttables WHERE tableNumber = " + Integer.parseInt(
selectedTableNumber));
 
[Code] ....

I am not sure how to enable this JPanel? I have another Jpanel to Disable but one question at a time i suppose.

View Replies View Related

JSP :: Disable Back Button When Logout

Apr 19, 2014

I have a website which requires login. After I enter username and password and click login button, a new page is loaded. In that page I have a username in the right up corner. When the user clicks logout button, Session.Clear() method is called and also Response.Redirect(" to login page "). It works OK, but the problem appears when I then click Back button in the browser. It gets me back to previous page with the username in the right up corner. Insted, I would like to show message asking user to enter password again so he can login properly.

What should i do at client side???

View Replies View Related

Enable / Disable All Textboxes In Panel

May 31, 2014

I am learning Java but have a strong C# background. I am trying to figure out the syntax to do this in Java. In C# I would do the following to enable all text boxes in a panel

private void EnableAll() {
foreach (Control ctrl in Panel1.Controls) {
if (ctrl is Textbox)
((Textbox)ctrl.Enabled = true;
}
}

Is there something similar I can do in Java to do the same thing.

View Replies View Related

JSF :: How To Disable / Hide Browser Scroll Bar

Mar 8, 2014

I am using jsf with richfaces. Scroll bar inside panel grid is displayed. Need to disable / hide the bowser (IE-9) scroll bar.

style="overflow:hidden"

Added above style, but not working.

View Replies View Related

Disable Administrator Permissions For C Drive

Feb 18, 2015

I want to disable the read write execute permissions for the users on C:/ drive. i.e. to disable their Administrator rights. How can I do it using Java?

View Replies View Related

JSF :: Enable / Disable Columns In DataTable PrimeFaces

Jul 21, 2014

I have created one dataTable in page and shown some columns but I want to show only those columns which have entries ( if any column doesn't have record then it should not be displayed on the page.) . How should I put validation on this and display table.

View Replies View Related

JavaFX 2.0 :: How To Disable Loading Of Images By WebEngine

Jun 2, 2014

I've searched everywhere but found no way to disable loading of images by Java WebEngineHow to do it?
 
Research done:
 
I found some ideas, such as using URL.setURLStreamHandlerFactory() to use my own URLStreamHandler, and having that analyze the URL to only return URLConnections for URL's that don't end in .jpg .png etc.

But that has many problems: Sometimes the image url doesn't end in .jpg, if it's a dynamic image, such as a captcha. So how can I disable automatic image loading from WebEngine?

View Replies View Related

How To Disable Ctrl Select Multiple Entries In A Dialog

Feb 18, 2015

I am using the following code to create a dialog , but my need is user can select only 1 entry . Using this code

can select multiple items by pressing Ctrl ... How it can avoid ... My current code is

Java Code:

SecureCloudStorage_Service service = new SecureCloudStorage_Service();
List<String> files = service.getSecureCloudStoragePort().listFiles();
SelectFileDialog dialog = new SelectFileDialog(this.getFrame(),true,files);
Toolkit toolkit = Toolkit.getDefaultToolkit();
Dimension screenSize = toolkit.getScreenSize();
int x = (screenSize.width - dialog.getWidth()) / 2;
int y = (screenSize.height - dialog.getHeight()) / 2;
dialog.setLocation(x, y);
dialog.setVisible(true); mh_sh_highlight_all('java');

View Replies View Related

JSF :: Enable / Disable SelectManyCheckbox Based On Radio Button Using Ajax

Feb 23, 2015

I'd like to disable/enable SelectManyCheckbox and the SelectOneMenu based on my selection. I have two radio buttons to be selected whether A or B. The SelectManyCheckbox and the SelectOneMenu should be disabled at the first run. When the user selects “A” the SelectManyCheckbox and the SelectOneMenu should be enabled and if the users selects “B”, the SelectManyCheckbox and the SelectOneMenu should be disabled and the items should be empty. I tried to use <f:ajax render="certificates"/>, but it doesn't work properly.

<h:selectOneRadio id="request" layout="pageDirection" value="#{user.hrRequest}" required="true" requiredMessage="Error: Select a Request Type">
<f:selectItem itemLabel=" Request A" itemValue="A"/>
<f:selectItem itemLabel="Request B” itemValue="B"/>
<f:ajax render="certificates"/>

[Code] ....

View Replies View Related

JavaFX 2.0 :: Disable Action Area Of SplitMenuButton But Not Drop Down Menu

Jun 27, 2014

Is there a way to achieve this? Using setDisable(true) deactivates the entire control. I want the drop down menu items to still be accessible, but the action area visibly inactive.

View Replies View Related

Install Java From Command Prompt With Parameters To Disable These Prompts From Occurring

Dec 23, 2014

We are using Kronos and when our staff trys to run reports -- they get three java prompts.The first one is asking if they would like to update java.The second one is do you want to run this application.The third one is allow access to the following application from this website

We are in a non persistent VDI environment so these prompts come up over and over and over.how to edit the Windows 7 image to disable all three of these prompts.Is there a way to install java from the command prompt with the parameters to disable these prompts from ocurring? if so i will uninstall and re-install with those prompts.

View Replies View Related

How To Load A Site Or URL

Jan 11, 2014

So the user is on a website and I want them to go to another site using the same browser and tab.Can this be done in java? And yes the java program is running on the browser .

View Replies View Related

Can Only Load One PNG File

Sep 10, 2014

I'am trying to finish my first Java Game with the slick2D library. I had it all working in eclipse but when i was about to make a jar file of it i did realize that i had to use class loader to load my png - SpriteSheets. But now to the problem. My ResourceLoader Class looks like this:

public static InputStream load(String path){
InputStream input = MyResourceLoader.class.getResourceAsStream(path);
if(input==null){
input = MyResourceLoader.class.getResourceAsStream("/"+path);
}
return input;
}

My init-Method in the BasicGame class, where i try to load my png-files looks like this:

public void init(GameContainer arg0) throws SlickException {
InputStream inputStream1 = MyResourceLoader.load("images/piratR.png");
sprite1 = new SpriteSheet("",inputStream1,32,32);

InputStream inputStream2 = MyResourceLoader.load("images/monkey.png");
sprite2 = new SpriteSheet("",inputStream2,32,32);

animation1 = new Animation(sprite1,200);
animation2 = new Animation(sprite2,250);
}

And that works fine for loading the FIRST png-file(eg piratR.png), but whenever i try to load another file it just loads the first one again. So in this case sprite1 and sprite2 looks the same though there are different images.

When i switch the "Load order" and Load sprite2 before sprite1 both animations looks different, so I'm sure that i have two different pictures and its always the one that i load first that will get loaded to all the other SpriteSheets.

View Replies View Related

Cannot Load JAR File

Feb 8, 2014

I can not load my jar file and it is telling me it can not find the main and I thought I had the right files in the right spots. Do I need the .class of my main file for it to make the jar file. I do not understand If I need to make a .jar out of the main then add all the other files to create the jar.

added manifest
adding: Board.class(in = 2431) (out= 1371)(deflated 43%)
adding: Cell.class(in = 1702) (out= 959)(deflated 43%)
adding: Mark.class(in = 1195) (out= 673)(deflated 43%)
adding: Outcome.class(in = 960) (out= 538)(deflated 43%)
adding: Player.class(in = 832) (out= 472)(deflated 43%)

TacToeGUIGame.jar

Error: Could not find or load main class TicTacToeGUIGame

View Replies View Related

Load A Class From Src Folder

Mar 13, 2014

Within my program I allow users to write their own code to be executed. I then save that code in a .java file and then compile. This gives me a .java file and a .class file within the same package in the src folder. However, the compilation process also creates a .class file in the build folder. When the user edits their code and then re-runs it, the .class file in the build folder does not get updated with the new data, but the .class in the src folder does.

What I want to do is to execute the .class file in the src folder and not the build folder. So far I have the following method, but that somehow refers to the .class file in the build folder:

public void runMethod(String packageFilePath, String className){
try{
URI fileURI = new URI("file:/src/uk/learningAid/UserInputs/");
URL url = fileURI.toURL();
URL[] urls = new URL[]{url};

[code]....

View Replies View Related

JSP :: How To Load A Properties File

Jul 21, 2014

I am using JPF controllers. Already, i am loading a properties file in the controller

(using annotations @Jpf.Controller(messageBundles = { @Jpf.Message Bundle(bundlePath = "validation.validator.Messages") },).

I have a problem. Depending on one of the request variables, i need to load different properties files. All these property files have same keys, but with different messages. I need to take the user to different sites(though internally, the backend logic remains same...Look and feel of the front end along with messages to be shown change to make the users feel they are being directed to a different site).

I am thinking of loading the properties file from the JSP when the user logs in first time from login page so that these properties are available until the session expires & not read the properties file in Controller.

View Replies View Related

Cannot Load Library JDIC

Jun 17, 2014

When I try to create a WebBrowser object

WebBrowser browser = new WebBrowser ();

I get this error

Exception in thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError: Can't load library: C:UsersChris.m2
epositoryorgjdesktopjdicjdic.9.5windowsamd64jdic.dll

The problem is that the path does not exists after windowsamd64jdic.dll

So i cant put the dll file there..its the first time i use dll files ....

View Replies View Related







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