Java Code - Changing Text Size In Windows Settings
Apr 14, 2014
I have a major problem. the text size is like 6 or 8 pt font and I can't read it. I'm trying to run a downloaded exe program which uses the jre7 which I had to download beforehand. the font size stays at 6 or 8 even if I try to change it in windows settings. it's a high res monitor on a lenovo yoga laptop. is there a way for me to edit the java code and manually change the font size?
How to deploy Java Swing application as windows software. I have tried the following to do this :
I have created jar file for my project after that created exe file using Launch4j and Advanced installer, exe file produced by both software are working fine but those are placing the jar file inside that exe file, My problem is any one who has that exe file can extract and view the source code by decompiling java class file. Is there any way to deploy java application without decompiling the code.
In the image, the color of the frame of the window/JFrame is black. My question is that can we set the color of this frame, or is it just provided by the operating system and whatever color is default color of windows in an operating system will appear in our application?
I am talking about the frame, the boundary in the JFrame container which contains the close, maximize, and minimize buttons.
But when i try to open it i get the message: Application Blocked. Click for details.
- The list i see doesn't work - If i click Ignore nothing happens - If i click reload nothing happens
When i read and search the net i have to change my java security settings. The security setting are HIGH and i cannot change that.But i can fill in an Exception Site List...The hello.html file is on my NAS : file:///X:/Lantronix/hello.html..I fill this in the exception Site list -> I get a message that it is a security risk to add this location.
I am currently writing a small drawing program and I am having trouble with changing the size of the shapes. To do this, I have to access the arraylist shapes, check whether pressedX/pressedY is on any of the shapes in the arraylist using the findShape() method and then when released, uses moveBy() in the Rectangle/Oval/Line class and moveShape() in the miniDraw class to move the shape and draw it in the newreleasedX/releasedY position.
So far I think I have pin pointed the problem to being the method in all the shapes classes, that checks whether the pressedX/pressedY which is the on() method, and the findShape() method in the miniDraw class.
I have a requirement where I have to send a file from a local system to unix box(present on client side) using java code.I have developed a code that is successfully sending the file from local system to client side unix box (I am connecting to client side unix box using VPN) provided I run the code in my eclipse IDE present in local system. But when I am running the same code in the unix box it is throwing null pointer exception.Might be the unix system is not recognising the local system. Please find the code.
Any way to get my Java window to open with a certain width and height. I've been googling and haven't found to much valuable information. Here is what I have so far.
import javax.swing.*; import javax.swing.event.*; import java.awt.*; import java.awt.event.*; public class JavaWindow{ //Bring up the frame. private JFrame f = new JFrame("JavaWindow");
[Code] ....
When you compile that it runs a small window. I would like that window to be bigger when the file opens.
Why can't I see the text when I compile the java code?
Java Code:
import java.io.*; import java.util.logging.Level; import java.util.logging.Logger; import javax.imageio.ImageIO; import javax.swing.*; public class WorldTravel { public static void main (String[] args){ JFrame f = new JFrame("World Travel!"); BG_text p = new BG_text();
So when writing my first "Hello World" app everything seemed to work just fine. I wrote the code, compiled it, and then ran the class file and it worked, I got the return Hello World! But when I tried to write another app which is basically the exact same thing just a different sentence, I keep getting a bunch of error codes saying illegal character. I did everything the exact same. I am using Text Edit on a Mac and using Terminal to execute the Java code.
Here is what I wrote....
public class MyFirstApp { public static void main( String[] args ) { System.out.println(“i rule the world!”);
I have a very basic question about the Maven. I compile 2 dependent projects on maven and they have a problem, then I change a code and I recompile the project.
After that in the jar file of this project, I see that the code is the same, the error also shows me that the file is the same ( from the error line i can understand that) ....
import java.io.InputStreamReader; import java.util.Scanner; public class FinalCombinations { public static void main(String[] args){ //Read number of values System.out.println("Enter the no of values");
[Code] .....
I am getting output like this
Enter the no of values 4
Enter the values 1 2 3 4
Enter the number for combination 2 C(4,2)=6 1 1 2 1 1 3 1 1 4 2 2 3 2 2 4 3 3 4
where as I want output like this..wit one array 1 2 1 3 1 4 2 3 2 4 3 4
I have a JFrame with four JPanels, SensorLL, SensorLC, SensorCR and SensorRR. They are instances of the class SensorUI. Each has a JLabel called Sensor.
The class SensorUI has a method writeSensor that writes to the JLabel "Sensor". I will have four temperature sensors. I have not started the code to read the temperature sensors yet. I will have a timer that will run once a second. When it fires I will read the sensors and display the result in the
JLabel "Sensor" in each jPanel.
I use MyMain to call FrameDemo and create the JFrame and a method
in FrameDemo to add the JPanels using addObject.
I can use SensorLL.writeSensor will write text to JLabel Sensor while in Mymain.
Then I start the timer ReadSensor.
When it times out it calls SampleSensors
For an experiment, while in SampleSensors I try to write to the JLabel in the instance SensorLL with
SensorLL.writeSensor("xx_");
I can't because it says it can't find the symbol variable SensorLL in SampleSensors class.
How can I "get to" that JLabel text when ever I need to?
Java Code:
public class MyMain { /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here //SensorUI SensorLL = null; System.out.println("Start of main"); //Schedule a job for the event-dispatching thread: //creating and showing this application's GUI. FrameDemo.createAndShowGUI();
So, Once again I'm attempting to make a Who Wants to Be a Millionaire GUI game. This is the actual game screen code
package WWTBAM; import java.awt.BorderLayout; public class GUIGame extends JFrame implements ActionListener { public static int moves = 0; public static boolean finished = false; public static boolean correct = true;
[Code] ....
When ever try and change the buttons text outside of the actual GUIGame constructor i can't. Like in the main method or the action listener.
The code won't work if you copy paste because it's a part of a larger package.
Create a dnd (dungeons and dragons) character creator and back ground generator, have it display and run on a gui, to start with i decided to creator the gui as i go so i can see the progress, first i tried eclipse and windows builder, well after 1 day of reinstalling windows builder in about 5 different ways from multiple guides and sometimes getting it to partly work ...
After doing some more research I have figured out how to get the main program to display the gui . Heres what i have:
package com.mrgreaper; import javax.swing.*; public class MainWindow { private JPanel mainWindow; private JLabel playerlbl; private JLabel playerNamelbl;
[Code] .....
Now this works fine and the gui displays when the program is run but I can't change the text of any of the jlabels or textfield. If I try to do it in the main class i need to change them from private to public static but then in the form builder it says "cannot bind to static field *name of field*" but if i take static off then i cant change its value!
From what i understand this is because the window is an instance, so how to i change the value in that instance? I could put all my code in the one class, the one that creates the gui, but i really want it seperate, i would like the gui to update as the code runs... So how do i do it, how do i change the contents of jlabels on the fly, read the contents of text boxes on the fly etc....
I tried adding a getter setter
public void setCharFirst(JLabel charFirst) { this.charFirst = charFirst; } in the MainWindow.class
Then i tried to set it from my main function
MainWindow.setCharFirst("test");
but it cant access it as my main function is static and it is not now can i make it static...
I'm new to Java, & am using Eclipse Helios. How do I change the text colour within the Quotation marks "Try Again" to red, or any other colour, so when I run it, it will display the new colour.
What I am creating is a clock. That goes round n round using "getcalendar". It's realtime, but the clock has a constant resolution of 800x800. I have carefully placed numbers from 1-12 on the clock using that resolution placing them pixel by pixel. Now if I resize the window, the clock resizes but the text, it fades away out of the screen because the resolution is too small.
I understand why this is happening, obviously because the strings are in a certain place just can't understand how do I make them scaleable? Is there an universal formula? Or do I have to draw every string relevant to some mathematical equation regarding to the screen size.
For example : g2.drawString(twelve, diameter / 2, screenheight / 3);
Basically the code is for a game which is displayed in a window. The statement if(false) //full screen mode is confusing me a little. How does this if work? it doesn't seem to be testing for anything so how does it ever get set to full screen mode? Is the if even needed? why not just code windowed mode?
public class Window extends JFrame{ private Window() { // Sets the title for this frame. this.setTitle("My test"); // Sets size of the frame. if(false) // Full screen mode
I don't get what I missed in the code. I used the example of changing the text of a button by clicking on it, but instead I also added a JLabel and tried to make the button change its text instead, but it didn't work. What did I do wrong?
I want to create 3 JTextFields in a row with all being of equal size.But my first Text field gets so wide than the other two.After adding each component at a time and seeing what causes the problem I realized that if I type a long text for the JLabel that's when this problem occurs.If I reduce the length of the text in the JLabel JTextFields get into the sizes I want. Here's my code
import java.awt.*; import java.awt.event.*; import java.lang.Math; public class Calculator1 extends JFrame { JTextField value1=new JTextField("0"); JTextField value2=new JTextField("0");
[Code] ....
How can I stop the JTextFields changing size when I change the JLabel label1's text length...
I have a large text file of 1 GB size. I need to print the line when a matching word is found in a particular line. Below is the code I am using. But if there are many lines that has the matching word, it's taking lot of time. Any solution to print the lines much faster.
Scanner scanner = new Scanner(file); while (scanner.hasNextLine()) { String line = scanner.nextLine(); if(line.contains("xyz")) { System.out.println(line); } }
I have been recently been working on a library to handle loading and saving settings in a Java application using annotations. Here is how the library is used currently:
package main; import dhuk.settings.main.SettingsManager; import dhuk.settings.main.SettingsTarget; public class Main{ public final String keybinds = "keybinds.txt", settings = "settings.txt"; // Constant strings to be used as the file's paths SettingsManager sm = SettingsManager.instance; // Singleton used to manage all of the settings files.
[Code] .....
Here is a link to my bitbucket repository: Click Here
Cannot reinstall java on this windows xp. Get an error -1 and install didn't complete. There are no java versions installed and apparently no java control panel either.