JavaFX 8 HTMLeditor cannot show 4-byte unicode characters - javafx

I added a HTMLeditor in my JavaFX 8 program:
I need to display some 4-byte unicode characters in it.
#FXML
private HTMLEditor htmlEditor;
#FXML
void initialize() {
htmlEditor.setHtmlText("<html><head><meta charset=\"UTF-8\"></head><body>𡖖</body></html>");
}
And this is the result:
I do the same in JavaFX WebView and the result is the same.
Is there any way to show the 4-byte unicode characters correctly?
Thanks.

Related

android fragment running in the background

i have the following chain of call
in a fragment i call zxing integrator to scan qr code which returns the result in
onActivityResult(int requestCode,int resultCode,Intent data)
of the fragment
The onActivityResult calls an Asynctask,
new getStaffIdTask(choosen_schema_for_scanning,userid).execute((Void)null);
whose onPostExecute(final Boolean success) calls the fragments listener as..
if(mListener!=null)
mListener.onScannedStaff(tableName,Integer.parseInt(id),Integer.parseInt(userid));
Back on the host activity the onScannedStaff function is called and in it replaces a fragment
#Override
public void onScannedStaff(String tableName, int staffid,int staffUid)
{
getSupportActionBar().setTitle("Staff Profile");
Fragment fragment= StaffProfileFragment.newInstance(tableName,staffid,staffUid);
FragmentTransaction transaction=getSupportFragmentManager().beginTransaction();
transaction.replace(R.id.home_boss_base,fragment,"scannedstaff");
transaction.addToBackStack(null);
transaction.commit();
}
The problem is that this fragment runs in the background and its not showing any UI at all. I cant figure out how to show it
I have also faced the same issue. Use LinearLayout in the fragment. Background color should be white and it should be clickable.
And don't call UI element from OnPostExecute().that will give you some major memory leaks or errors.

how to setvalue in combobox from database in javafx

I have one combo in javaFX that is populated with categoryData
#FXML
private ComboBox<categoryData> comboCategory;
comboboxCategory suppose to fetch data from database when i clicked the edit button, but i get an error with this line
comboCategory.getSelectionModel().select(rs.getString("category"));
here is my error:
method selectionModel.select(int) is not applicable
string cannot be converted to int
method selectionModel.select(categoryData) is not applicacle
string cannot be converted to categoryData
please help me i am searching for this since yesterday but i got nothing. thank you for your response.
I FOUND THE ANSWER OF MY QUESTION
Predicate<categoryData> matcher = data1 -> (data1.getCategory()).equals(rs.getString("category");
Optional<categoryData> opt = data.stream().filter(matcher).findAny();
comboCategory.setValue(opt.get());

How to handle (i.e Read/Write) private DICOM Tags using DCMTK

With respect to handling private tags in DICOM. Could any one give me the coding examples for below :
1. Writing the private tags fixed attribute tag.
2. Similarly examples for reading the private tags.
Note : Some times private tags are getting relocated. How to read the private tags when the private tags gets relocated.
ex: Some times Private Creator will be at
(4201,0010) LO [Test Data] # 16, 1 PrivateCreator
(4201,1000) IS [11] # 2, 1 Unknown Tag & Data
or it can be at
(4201,0011) LO [Test Data] # 16, 1 PrivateCreator
(4201,1100) IS [11] # 2, 1 Unknown Tag & Data
Any suggestions either while reading relocatable private tags.
Similarly how to avoid relocation while writing.
See example Dcmtk Wiki How to add private data elements
The dcmtk source also includes a private dictionary file (private.dic).
This dictionary can be loaded by an enviroment variable e.g. DCMDICTPATH=C:\private.dic or by code
e.g.
DcmDataDictionary& dict = dcmDataDict.wrlock();
dict.loadDictionary(dictionaryFilePath);
dcmDataDict.unlock();
You should add your private elements to the private dictionary in the correct syntax. Just have a look at the private.dic file, that should help a lot.
e.g. (Group, Private creator Name, element) VR Description VM
(0019,"MY PRIVATE CREATOR NAME",1000) DS Description 1
If your private tags are known by dcmtk, then you can access them as usual.

How can I create a button on a form in a J2ME application?

I attempt to make a simple "hello world" application, where on clicking the button , it prints a string "hello world". How can I add a button on a form?
I need to create a button, on which when I click it can produce a string. How can I add a button without using canvas in j2me?
There is an API for this, but you better think twice whether you really need it.
API is desctibed in the Appearance modes section for lcdui Item objects
The StringItem and ImageItem classes have an appearance mode attribute that can be set in their constructors. This attribute can have one of the values PLAIN, HYPERLINK, or BUTTON. An appearance mode of PLAIN is typically used for non-interactive display of textual or graphical material. The appearance mode values do not have any side effects on the interactivity of the item. In order to be interactive, the item must have one or more Commands (preferably with a default command assigned), and it must have a CommandListener that receives notification of Command invocations...
A StringItem or ImageItem in BUTTON mode can be used to create a button-based user interface...
Note that this section also explains cases when using button appearance might be problematic:
...This can easily lead to applications that are inconvenient to use. For example, in a traversal-based system, users must navigate to a button before they can invoke any commands on it. If buttons are spread across a long Form, users may be required to perform a considerable amount of navigation in order to discover all the available commands. Furthermore, invoking a command from a button at the other end of the Form can be quite cumbersome. Traversal-based systems often provide a means of invoking commands from anywhere (such as from a menu), without the need to traverse to a particular item. Instead of adding a command to a button and placing that button into a Form, it would often be more appropriate and convenient for users if that command were added directly to the Form. Buttons should be used only in cases where direct user interaction with the item's string or image contents is essential to the user's understanding of the commands that can be invoked from that item.
From the class diagram I found in an old J2ME book, and which is online at http://www.stardeveloper.com/articles/display.html?article=2002121101&page=2 it seems that J2ME don't do buttons. Well no need for them on an old mobile phone.
Just create a "hello" command and add it to a menu or form. The system will then put it on whatever button is available on your device. For touch screen devices that probably turns it into something clickable.
Here's the code
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Form;
import javax.microedition.lcdui.TextBox;
import javax.microedition.lcdui.TextField;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;
public class HelloWorld extends MIDlet implements CommandListener {
private static final String HELLO_WORLD = "Hello, World!!";
private Form form= new Form ("");
private Command exit= new Command("Exit", Command.EXIT, 0x01);
private Command ok= new Command("OK", Command.OK, 0x01);
private Command hello= new Command("HELLO", Command.SCREEN, 0x01);
private TextBox textBox= new TextBox("Hello World", HELLO_WORLD, HELLO_WORLD.length(), TextField.UNEDITABLE);
public HelloWorld() {
this.form.addCommand(exit);
this.form.addCommand(hello);
this.form.setCommandListener(this);
this.textBox.addCommand(ok);
this.textBox.addCommand(exit);
this.textBox.setCommandListener(this);
}
protected void destroyApp(boolean unconditional)
throws MIDletStateChangeException { }
protected void pauseApp() { }
protected void startApp() throws MIDletStateChangeException {
Display.getDisplay(this).setCurrent(this.form);
}
public void commandAction(Command c, Displayable d) {
if (c == this.exit) {
this.notifyDestroyed();
}
if(c == this.ok) {
Display.getDisplay(this).setCurrent(this.form);
}
if(c == this.hello) {
Display.getDisplay(this).setCurrent(this.textBox);
}
}
}

Cannot bind text field to selected item in JTable in NetBeans

I am trying to use NetBeans to bind a JTextField to the selected element of a JTable.
The JTable gets its data from an AbstractTableModel subclass which returns Cow objects. At present, each Cow object is displayed as a String through its toString method.
I am trying to bind the text property of the JTextField to the name property of the Cow object which is selected in the JTable.
I bound the text property of the JTextField in NetBeans to:
flowTable[${selectedElement.name}]
This produces the following line of generated code:
org.jdesktop.beansbinding.Binding binding =
org.jdesktop.beansbinding.Bindings.createAutoBinding(
org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE,
cowTable,
org.jdesktop.beansbinding.ELProperty.create("${selectedElement.name}"),
cowNameTextField,
org.jdesktop.beansbinding.BeanProperty.create("text"));
The bound value of the text field is always null.
What am I doing wrong?
Does your Cow class have a public String getName() method returning the name?
If it doesn't, the outcome you're getting would be expected. If it does, could you post more code (your data class, tablemodel, table...).
If you only are interested in a String in the table, and not the Cow object itself:
table.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
#Override
public void valueChanged(ListSelectionEvent e) {
if(!e.getValueIsAdjusting()) {
Object value = table.getValueAt(e.getFirstIndex(), COLUMN_X);
jTextField.setText(value.toString());
}
}
);
Does your Cow class support adding a PropertyChangeListener? I did not use the beans binding support from NetBeans that often, but I remember you needed it. Anyway, a little more code could help with finding out whats going wrong.

Resources