I am building a chat server/client and would like to have it so when a user sends a message, the message pops up in the main chat area beside their name, which I would like to be in bold font. Something like "Alan: Hello, how are you?". I can't find a way to do this with a text area or on a string. Do any swing components suitable for use as text areas support bolding of certain sections of the string that you will set to it?
package midtermproject; import java.util.Scanner; //Using for scanner class import java.awt.Font; //Using for bold public class MidtermProject { /** * @param args the command line arguments */ public static void main(String[] args, String setBoldText) {
[code]....
I need the console to display BOLD for the movie title only. I imported java.awt but I do not know what else or how else to do it. I have looked in my book, online, youtube, yahoo answers and I want to figure this out. I found an answer on here that someone talked about java.awt but did not specific what.
I have a button that bolds all the text in the main div. I am trying to get it to change back to the normal text after it has been bolded. But I cant figure it out. It bolds the text and changes button value when button value is "Bold", but when button value "UnBold" and user clicks button the text does not unbold. Here is my function.
function boldDiv() { var button = document.getElementById("firstbtn"); var oldHtml = document.getElementById('main').innerHTML;
I am facing an issue with the TableView in Java FX 8.
I am having a TableView created with data with scrollbars automatically added in when the Window is minimized. I moved the horizontal scrollbar to right and then maximized the window to full.
After this the column headers remained no longer aligned with the content. When I click on any column header then the header aligns with the content.
The Issue is replicable also in case when a vertical scrollbar gets automatically added to a table view with preloaded data...
I have a column of my TableView that just shows row numbers, and I would like to style the cells in that column so that they appears just like a column header (so the same styling as the headers use). I presume there is some simple way to do this by tapping into the right style class, but I am not sure which one.
is possibile to change the color of the sorting arrow that appears in the columns of the Table View by css? My attempts have failed and I have not found any documentation, nor is there any reference in the Modena css.
I have a Dialog with no buttons (the dialog pane contains some graphic elements which act as my buttons). I show the dialog and try to click the close window button on the dialogs title bar, and the dialog does not close! I read the docs and it appears that only dialogs that have one or more buttons can be abnormally closed (and only under certain well defined sensible conditions). How can I abnormally close a dialog with no buttons?
I want to create a button bar that is the same as the confirmation dialog button bar -- so an OK and cancel button layed out in the platform specific way, and with the same styling.
I have made some progress via a hack -- create an alert dialog, and extract the buttons in the dialog using lookupButton, and then put those buttons in a toolbar. But this doesn't necessarily get a toolbar with the buttons in the correct order. If I could get the button bar out of an alert dialog I would have a solution, but I can't see to do that.
I'm using the tableview-component. The size of font of header is greater then that of cells. The problem is: the width of the column bases on the cell with the longest string and if the header-string is longer then the header gets truncated (it shows ellipsis) and I have to change the width of column manually. How could I solve this problem? The easiest way would be to compute the column-width on myself. I can't find any method in javafx, that would allow to compute the width of string in pixels. In Swing there is the FontMetrics class and Graphics class, so it is easy to get the width in pixels. Are there any pendants to this classes in JavaFX?
I'd like to change the text on the two buttons which I have in my Dialog Box, how should I do this?
Also, when I click the X Button in the top right of the Dialog Box, nothing happens, and the program only stops when I end it in jGrasp. How do I make this button close the program when clicked on?
import javax.swing.*; import java.util.Random; public class SwingInputExample { public static void main(String args[]) {
I'm currently working on a project which requires to have text displayed along a curve. If found this entry a good starting point. It works fine for me on my develompment machine, however the customer on his machine noticed some issues.
The basic idea is to define a path for the text, explode the text into the separate characters and animate them along the path the fraction of the character of the whole lenght. So with a animation duration of 10 seconds and a label of ten characters, the first character would be animated along 1 second, the second 2, and so forth.
This is done by jumping to the designated time in the animation, start the animation and stop it immediately.
Now the problem as I see it, for stopping the animation a separate timer is used, so it can happen that at the time the animation is actually stopped, the animation moved further than the first frame. The effect is that the last characters of the text appear in front (wrapped around).
As I have no evidence to prove or disprove my theory, what do you think is this plausable? I can see a workaround for this issue by defining a path for each character and then let the animation run to the end. While I can set the duration of the animation to 1 ms which should not be visible to the human eye, I'm not able to make the characters invisible and turn the visiblity on when the animation finishes, they always become visible at the start.
Or create my own animation/transition for placing the characters.
I have a requirement where in the content of the text area is dynamically populated from the database. I am able to successfully retrieve and display the data on the text area.
However when the content is too large, I am not able to dynamically set the height of the text area. When I try to display the same as a label, the display is flawless, dynamically sets the height as per the content. So, I tried to create a label, with same content and dynamically bind the height to the preferred height as below, but it doesn't work.
// Generate User Note Description TextArea textArea = new TextArea(); Label text = new Label();
// SETTING THE TEXT TO A LABEL TO RETRIEVE THE HEIGHT text.setText(usrNotes.getNote().trim());
I am using javafx 2 in my project,After user change the text in HTMLEditor,i will save the context to database,if text wasn't changed,then i do nothing .so i want to know if the user have changed the text.
I only saw how to add text changed listener to HTML web viewer. So how to add text changed listener to htmleditor?
Our users want us to build the following ontop of a TableView: When a key was typed, the row selection shall change to the first row showing a cell in a given column whose getText() starts with the typed letter. Such a functionality is known from lots of other software, like the Windows file explorer, where you can type a key to jump to the first file starting with that letter. It shouldn't be too complex to build, but due to the separation of "items" and "formatted cell text" it actually is... :-(
Using TableColumn.getCellData(S) we can access the item, but at that point, we don't want to repeat the formatting just for the sake of this functionality. We have set a cell factory providing this format, so the view looks great, but how can we access that formatted String programmatically to jump to the right row at a later time?
Switching from Swing to JFX 8, I am trying to find out how to do something I would normally do in a super-simple ListCellRenderer, i.e. customize the String displayed for an item. I tried this:
ComboBox<Integer> combo = new ComboBox<>(); combo.getItems().addAll(1, 2, 3); combo.setCellFactory(new Callback<ListView<Integer>, ListCell<Integer>>() { @Override public ListCell<Integer> call(ListView<Integer> param) {
[Code] .....
However, when I do this, the customized String is not used for the selected Item (rather the standard toString() value of the item). Apart from that it is no longer selectable using the mouse (I submitted a bug report for this at [URL] .... but that is not really the point of my question.
Anything else I have to do to make sure the selected item is also rendered using the custom cell or is there a different mechanism for this?
Is it possible to validate the input of a TextField that ist bound to a Property before both values are updated? Following is an example of my problem .....
In my model, there is a SimpleDoubleProperty discount. As you can see, there is some validation logic in the method setDiscount that might be used by other parts of the model.
public class Model { private DoubleProperty discount = new SimpleDoubleProperty(); public DoubleProperty DiscountProperty() { return discount;
[Code] ....
My Main class has a Textfield that is bound to the discount-property, a button to put the current value of the discount-property to console and a button to call the setDiscount-method ......
public class Main extends Application { @Override public void start(Stage primaryStage) { try { Model model = new Model(); BorderPane root = new BorderPane(); Scene scene = new Scene(root,100,100);
[Code] .....
By using the bidirectional Binding between the TextField and the discount-Property, the setter in the model is never called and therefore there is no validation of the input value. When calling the setter programatically with the second button, everything works as expected.
I experimented with neglecting the Binding and using ChangeListeners for both the TextField and the discount-Property but only produced infinte loops when both listeners triggered each other alternating.
I try to bind the text-property of a selected cell of a TreeView to a label. So if the user click on a cell in the treeview the label should show the cell text. Now I am quite confused about the options I got to do so. Should I use label.textProperty().bind( ... ??? ... ) The treeview.onMouseClicked()property? or something different?
how to get the first few hex symbols of a file in java, for example if i input a pdf into my coding i want my program to output, e.g "25 46 44 38" ....
I have been able to print out the hex of a whole file but not managed to set a maximum read limit so that my code only takes a certain amount of values ....
This is the code that I wrote but I have two problem with two buttons one of them ... I want to delete the selected text inside the text Area which represented as b[8] and the other button that I want to select parts of the texts which represented as b[0]....
I want to create a JTable which "Analysis","Date" and "Price" the names of columns in header. Here's a piece of my code :
String sql = "Select name, Price from analysis_tab where name ='" + idclicked + "'"; DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd"); Date date = new Date(); PreparedStatement preparestate = database.con.prepareStatement(sql); ResultSet rs = preparestate.executeQuery();
So, the value of Analysis and Price were stored in my Data Base, and the Date get the value of the current day. How can i create this JTable and how can i set the value into it ?