How to remove thin back frame around pdf page at ICEpdf? - java

I'm making PDF displaying application with ICEpdf. I an trying to make some fancy layout according to good design practices. I use this code
System.getProperties().put("org.icepdf.core.views.background.color", "#FFFFFF");
System.getProperties().put("org.icepdf.core.views.page.border.color", "#FFFFFF");
System.getProperties().put("org.icepdf.core.views.page.shadow.color", "#FFFFFF");
To make background of viewer component white and to remove frame and shadow of the page. But the thin black frame around the page is still there:
Any chance to get rid of it? I want to acnieve illusion that pdf page is stretched to the size of parent container. I use swingNode inside JavaFX application (in case that have some importance).

Solved by wrappind PDF Swing component into AnchorPane and setting anchors to small negative values:
AnchorPane.setLeftAnchor(question, -5.0);
AnchorPane.setBottomAnchor(question, -5.0);
AnchorPane.setRightAnchor(question, -5.0);
AnchorPane.setTopAnchor(question, -5.0);

Related

Wrapping Text in Java Swing

Okay, I am kind of desperate right now. I hope you guys can help.
I need to layout content panels with Java Swing. The Problem is, that every content is different. So I need a panel that resize itself for every content. Basically what LayoutManagers are invented for.
I need a left panel and a right panel. The widths of the panels should be fixed. The heights should adjust to the given content
|<---- 30% ------->|<----- 70% -------------------->|
Easy going I thought, but it just wont work. I tried different layout managers. Some of them keep the 30% rule, but doesn't wrap the content and just display them in one single line (BorderLayout).
If a LayoutManager does support line-break (even if its just for HTML text but that is fine for me) it wont support the fixed width. A combination of both didn't worked for me either.
Note that I need to stick to Swing and can not use another more advanced library because the system I am developing for is stuck to Java 1.5. Furthermore, I know the total screenwidth so I could calculate the width of the panels to work with fixed widths, but I need to be flexible with the height.
You can achieve this by using nested BorderLayouts. Start by setting your Panel's layout as BorderLayout.
After that, for each left and right panels, set layouts as BorderLayout again. At this level, you will set %30 and %70 ratio.
Within this layouts, add your contents to NORTH layouts. This will enable your panels' height to match given content.

How to get my components to re-size properly with JFrame in execution Java eclipse GUI Builder

i want to create this exact Jframe with Java Eclipse Software
(image : http://icpb.com.br/wp-content/uploads/2013/03/membros.png)
And I want the size to be fixed ( probably the same as the image) the problem is when it will be executed in a different computers with different screen resolution will it be the same or some components will be hided in borders?
I need some code lines which will allow a dynamic resizing in different screen resolution without any bad effect of the JFrame Design . Thank you
If you want to have a dynamic resizing you should give a try to the GroupLayout that can easily be managed by Window Builder in the Eclipse IDE.
Once you will enable GroupLayout WindowBuilder Design view will show you two arrows on the corner of the component where you can arrange the alignment and the anchor of the component .

WindowBuilder - Component size

Im trying to make a fullscreen application.
I would like to know how to make the component that I add on the JFrame to occupy a part of the screen on every resolution.
Design tab mode:
When I run on fullscreen i get this:
how can I make this following interface adjust to full screen?
Here's an idea of the some of the basic layout managers and which ones respect preferred sizes (meaning if preferred size is respected, as container expands, component will not expand with it, and vice versa)
That being said, you may want to use a BorderLayout, and place your top component at the BorderLayout.PAGE_START. Ad the screen increases, so will the component contained in that layout position. (Note: the example's main container uses a BorderLayout)
As far as the image, if you want to stretch, I'd take a look at StretchIcon from Darryl Burke. This will keep the image to a relative size.
Also a common practice is to nest panels with different layout managers, to get your desired result. You can see an example here by Andrew Thompson
Also see more about layout managers at Visual Guide to Layout Managers

Graphics and applets

I am currently working on an assignment and need to create basic controls (buttons) for the Mandelbrot set that will operate as a JApplet. The graphics is initialised in the init() method and a method which draws the Mandelbrot is called in start(). The problem is, I have searched high and low and cannot figure out how to add a GUI to my applet because
I don't explicitly add the mandelbrot to a JPanel , and..
I have no room left it seems to add a GUI because the Mandelbrot takes up the entire JFrame.
I had one idea which was to set the size of the JFrame, set the size of the Mandelbrot graphic to only be say 4/5 of the whole frame, and add buttons to the remaining portion?
Does that sound like a good solution?
Does that sound like a good solution?
No. The panel in which the Mandelbrot is drawn should return a sensible preferred size. Add the rendering panel and the buttons to a layout or groups of layouts using layout padding, borders and button margins for white space.
But I am a little confused by the reference to japplet tag yet the body of the question mentions both JApplet and (twice) JFrame.
An applet has to make do with whatever size it is provided by the HTML (or JS, in the case of the deployment toolkit script) that launches it.
A frame can call pack() on a properly laid out UI and expect to be the smallest size needed to display the components.
General tips
Why code an applet? If it is due to spec. by teacher, please refer them to Why CS teachers should stop teaching Java applets.
For deploying Java desktop apps., the best option is usually to install the app. using Java Web Start. JWS allows the user to launch a JFrame from a link in a web page.
Java GUIs might have to work on a number of platforms, on different screen resolutions & using different PLAFs. As such they are not conducive to exact placement of components. To organize the components for a robust GUI, instead use layout managers, or combinations of them1, along with layout padding & borders for white space2.

Vaadin App: Show scrollbar(Left-Right) on bottom of browser when not in full screen

In ever Vaadin app I've looked at including my own, if your browser is in non-full screen mode(Partially minimized), there is no horizontal scrollbar at the bottom making the app impossible to use without a full size browser window.
Many of my users have 2 browsers open at a time, each occupying half the screen so they need a horizontal scrollbar to use the app.
Is there a way to force the browser to show a horizontal scrollbar with a vaadin app?
I don't know about forcing the scrollbar to displayed, but Panel and Window classes implement the Scrollable interface, which allows them to be scrolled.
Just don't use a relative width and you will get the horizontal scrollbar. I believe you can also set Panel's width undefined and let the components inside Panel define the actual width.

Categories

Resources