How to add button with "icon only" layout to pdf using PDFBOX? - java

How to add button with layout "icon only" to pdf using PDFBOX?
create a button with this properties
I have try this example before, but just can't set to the button properties I want.
[edit]
This the button I created using acrobat.
And This the button i created using PDFBOX
My question is in PDFBOX how to create a button similar to the button created in acrobat?

The desired layout information may be stored in the TP entry of the appearance characteristics dictionary:
Key
Type
Value
TP
integer
(Optional; pushbutton fields only) A code indicating where to position the text of the widget annotation’s caption relative to its icon:0 No icon; caption only1 No caption; icon only2 Caption below the icon3 Caption above the icon4 Caption to the right of the icon5 Caption to the left of the icon6 Caption overlaid directly on the iconDefault value: 0.
(ISO 32000-1, Table 189 – Entries in an appearance characteristics dictionary)
Thus, you may want to try setting the TP entry of the PDAppearanceCharacteristicsDictionary fieldAppearance in the referenced code to 1.

Related

I have created popup menu with component as JCheckBox but I am not able to read its value when I click it

I have created popup menu with component as JCheckBox but I am not able to read it's value when I click it.
Using this code:
JCheckBox cs_x=new JCheckBox(s1);
popCourse.add(cs_x);
boolean checked = cs_x.isSelected();
Is this what your are looking for?

Change font style of highlighted text java

Below is the code I have to set all text within my text pane to bold but how can I get only the text that I have highlighted to be bold and achieve the following?
private void jButtonBoldActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
jTextPaneBody.setFont(jTextPaneBody.getFont().deriveFont(Font.BOLD));
}
If the highlighted text is normal, change it to bold when I click the button
If the highlighted text is in bold, change it to normal when I click the same button
Can't be done with a (J)TextField. If you need this functionality, you can use a JTextPane with a StyledEditorKit and a StyledDocument

JavaFX8 How to pass the "press" status to child?

I have an ImageView in a Pane, and the pane has been set a MouseEventHandler to do some actions.
The ImageView's Image is defined in a CSS file as below:
.imageView{
-fx-image: url("image/normal.png");
}
.imageView:pressed{
-fx-image: url("/image/press.png");
}
Under normal status, the ImageView's image is 'normal.png'. When the user presses the ImageView, its image will be changed to 'press.png'. Then, when released, its image will be changed back to 'normal.png'.
However, if the user does not press on the ImageView's image exactly, even though Pane's MouseEvent is trigged, the image will not be changed.
How can I do to change ImageView's image when its parent Pane is pressed. For instance, on Android, the image will be switched automatically. It is very convenient.
Add a style class to the pane ("image-container", for example), then in the css do
.imageView{
-fx-image: url("image/normal.png");
}
.image-container:pressed .imageView {
-fx-image: url("/image/press.png");
}

SmartGWT- how to change filter button icon in listGrid?

I want to change this filter icon to another one, I have tried this method setFilterButtonProperties(newButton);
but it doesn't work.
here the image which I want to change.
Try this one
Button newButton=new Button("");
newButton.setSize("18px", "18px");
newButton.setIcon("[SKIN]/RecordEditor/add.png");
listGrid.setFilterButtonProperties(newButton);
Note: Change the icon path and size as per your requirement.

Javafx change Tab X to image icon from url

How could I change the Tabs close icon X to an image in javafx? I have tried setGraphic(), but it only takes a node... the image i want to set it to is http://eclipse-icons.i24.cc/ovr16/progress_rem.gif
Make the image a valid node using ImageView, but that seems to be for icons.
Tab tab = new Tab();
Image image = new Image("http://eclipse-icons.i24.cc/ovr16/progress_rem.gif");
ImageView iv = new ImageView(image);
tab.setGraphic(iv);
Get rid of the default shape in CSS or write your own or use a background image
.tab-close-button {
-fx-background-color: transparent;//-fx-mark-color;
-fx-shape:null;
-fx-background-image: url("/progress_rem.gif");
}
You'll have to provide your own click handler without the css shape, or something to click on.
This is what you get with css.

Categories