3 dots java title border - java

does anyone know how to remove those 3 dots from java components?
my problem : a java widget with a title border which, after resize, keeps adding those 3 dots.
I would want for it to display the truncated title which fits that given area.
I managed to set its justification to the left but those 3 dots keep reappereaing...
or, at least, where, in java library, are those 3 points drawn? I searched through java libraries and couldn't fin it.
This happens using java 1.7

You'd normally do that in the UI classes. Here's a similar question: Java JLabel/JButton: on some systems I get "..." (an ellipsis) and on some systems I don't. how can I force to disable the ellipsis at all?

It is not Java or Swing who display the three dots (the "ellipsis"), it is the underlying OS (Windows, Linux ...).
The Java just sets the native window title property.

Related

Rendering graphical elements through command line interface in Java

Is there a way to render graphical objects in console using standard jdk API?
For instance I want to render moving image in console (not via awt/swing).
The console itself can only render characters..
But if you mean you want to render an image from a command line app. (that is later displayed in other apps.) then yes, though the 'moving' part does not make much sense unless you mean an animated GIF.
No you cannot. The console renders characters so ASCII-art is your best choice.
Also this has been answered before: displaying-images-in-a-console-application

Why does JavaFX add extra spacing between letters when using the Text component and how do I fix it?

I'm trying to use the text component of JavaFX to do some nice headline typography in my application. How ever the letters in the text are not spaced evenly. For example in the word "visiting", the "iting" part seems disconnected from the first part.
In the sample image I'm using Arial but this kind of bad spacing happens with every font I tried.
This only happens when "gray" anti-aliasing is used (-fx-font-smoothing-type: gray;). One obvious solution would be to change -fx-font-smoothing-type to lcd, but that would result in the text having jagged edges.
The only thing remotely mentioning something like this is the jira issue RT-14187, but that seem to have been resolved in javafx 8 (jre 8).

find name of icons in control panel

Is there a way to obtain the name of the icons in the Windows Control Panel, and find out their coordinates?
One more question - if I have an application running and that contains buttons, is there a possible way to obtain the name of the button, as in string?
http://msdn.microsoft.com/en-us/library/ee330741(v=VS.85).aspx lists the "canonical names" of each control panel item. For example, Microsoft.DateAndTime for the one that sets your date and time. http://msdn.microsoft.com/en-us/library/cc144191(v=VS.85).aspx shows how to use WinExec (which you may or may not be able to use from Java, I don't know) to launch an item given it's canonical name, for example
WinExec("%systemroot%\system32\control.exe /name Microsoft.WindowsUpdate", SW_NORMAL);
There is quite a lot of community content on that page, indicating that perhaps it's a bit trickier than the documentation suggests. I suspect that getting your code to work smoothly on XP, Vista, and 7 may be frustrating.
The Mail icon is missing from MS's list.
This source indicates that it's canonical name is "Mail".
Check out: http://msdn.microsoft.com/en-us/library/bb776778(v=VS.85).aspx

How to change display settings programically with java?

Is it possible to alter (change/update) display settings (configuration) in Windows XP using Java programming language?
I would like to do something like this:
Display[] displays = WindowsXPSystem.getDisplays(); //get all available displays (monitors). assume there are currently two monitors connected
Display d0 = displays[0]; // the first is 24" and is positioned on the left
d0.setPrimary(true); // and it should be primary, so all new windows open on it.
d0.setSize(new Dimension(1920,1080)); //update screen size (resolution)
d0.setPossition(0,0); //and position it on the left
Display d1 = displays[1]; //second monitor is also present
d1.setSize(new Dimension(1440,768)); // and it's 14.1" laptop's display
d1.setPossition(1920,332); //it's positioned on the right
Any ideas/suggestions/APIs how to update display settings with Java?
I think this is not possible with plain Java. Have a look at this question here:
Detect and Change display resolution permanently using java
as stated there, it's maybe possible to use any native Libraries through JNI (Java Native Interface) which kind of wraps native Libraries. But you will loose your platform independency then.
There is no plain Java solution to your problem. The function is way to specific for a generic implementation.
You could however, if you really need to implement this use a JNI library, that wraps the Windows functionality of adjusting the screen resolution.

How do you specify to display a diamond in a NSMenuItem (minimized window indicator)?

I'm creating a JNI to display an application wide menu bar instead of the JFrame specific one. This allows me to keep a menubar displayed even when no JFrames are present. I've hit a small snag, in my window menu I can't figure out how to display a diamond for the windows that are minimized. As far as I can tell in the standard API there's only three states available On, Off, and Mixed where mixed is a dash. Is there a way to show the minimized diamond using standard API? Or am I going to have to create a diamond image and use that?
AppKit isn't using a public API to get this image. It's using _NSGetThemeImage which pulls an image out of the old HIToolbox Appearance Manager theme resources and converts it an NSImage. I wan't able to find an equivalent public API.
If you want to mimic how AppKit does it, use:
NSImage* _NSGetThemeImage(int num);
[menuitem setState:NSOnState];
[menuitem setOnStateImage:_NSGetThemeImage(155)];
Better yet, use this code to grab the NSImage, save it to a TIFF file, and then include that TIFF in your program. That way you avoid using private APIs in the shipping code. I doubt Apple would complain that you're stealing their diamond. ;)

Categories

Resources