user-interface

Filling a JList with data

寵の児 提交于 2021-01-27 10:21:10
问题 Does anyone have any good tutorials on how to fill a JList (within a JPanel ) with user inputted data. Specifically, I want to add people to a selected roster. Is this a matter of filling it with an ArrayList ? Any help would be much appreciated. 回答1: create a ListModel which wrapps your java.util.List (e.g. by extending AbstractListModel) configure JList to use this model create and configure a renderer to format/ display the Objects in your list as needed http://docs.oracle.com/javase

Is there a Tkinter/ttk style reference?

谁都会走 提交于 2021-01-27 09:01:33
问题 With ttk one can produce code like the following: style.configure('TButton', font='helvetica 24',foreground='red', padding=10) Is there a list of the different options (e.g. font, foreground, padding) and the values (e.g. helvetica 24, red, 10) associated with each of them? I've been searching online and have yet to find such a reference. Also, is there a css-like thing we can use to style a TKinter GUI? Or is ttk my best bet? 回答1: Most information you should find in Tk Reference Manual. See

How do you stack buttons vertically on a JOptionPane with JDialogs?

人盡茶涼 提交于 2021-01-27 07:49:18
问题 I'm trying to stack three buttons vertically onto a JOptionPane using createDialog, but it's not quite working with a GridLayout. Also, I'm not sure how to get rid of the 'OK' button as well. You're probably wondering why I am doing it this way, but this is the way I was told to do it. I think I can use a JFrame, but I don't think that goes well with a JOptionPane because that's where I want the buttons stacked. It should be like this: | Need Help | | Help Me | | Counting | I need

How do you stack buttons vertically on a JOptionPane with JDialogs?

时光毁灭记忆、已成空白 提交于 2021-01-27 07:47:53
问题 I'm trying to stack three buttons vertically onto a JOptionPane using createDialog, but it's not quite working with a GridLayout. Also, I'm not sure how to get rid of the 'OK' button as well. You're probably wondering why I am doing it this way, but this is the way I was told to do it. I think I can use a JFrame, but I don't think that goes well with a JOptionPane because that's where I want the buttons stacked. It should be like this: | Need Help | | Help Me | | Counting | I need

Android Persist A SnackBar Across Activities

☆樱花仙子☆ 提交于 2021-01-27 06:00:52
问题 Situation : User has logged in , you show a snack bar which says successfully logged in and then navigate to another intent but the problem is that when you navigate the snackbar is cancelled / destroyed . how do we persist it across activities like the way a Toast does , no matter what activity you navigate to .. it stays alive and healthy and follows it's timeout . 回答1: You can make a custom toast similar to the snack bar: custom_toast.xml: <?xml version="1.0" encoding="utf-8"?>

Compile sass file inside browser

江枫思渺然 提交于 2021-01-27 06:00:20
问题 I am trying to go about creating a system for my users where they can select particular SCSS files they would like to be included in the project. They do this through a browser. Once they check off all the related SCSS files, they want to hit a browser based "compile" button to generate the final CSS. Is this possible? I have looked in the web for sometime but was unable to find anything. I know it's possible as I have seen it done for bootstrap, on their website. Would someone be able to let

Displaying (rendering) HTML from a string in QT

妖精的绣舞 提交于 2021-01-26 18:00:41
问题 I have html in a QString, what widget can I use to display it? (QWebView is not necessary as I dont access Internet) 回答1: QWebViews setHtml(): The QWebView class provides a widget that is used to view and edit web documents. In Qt QWebView is the widget that renders pages for you - if you don't need the networking features it provides, simply don't use them. 回答2: Depending on what HTML tags you are using, you might be able to get away with a QTextEdit . It has support for most of HTML,

Javafx adding ActionListener to button

心不动则不痛 提交于 2021-01-22 01:29:48
问题 button.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { label.setText("Accepted"); } }); In the code above we are defining what will happen when we press the button. This is all good but I wanna create new ActionListener and then add it to my button. Normally in JButton I can just add ActionListener like this: button.addActionListener(someControllerClass.createButtonListener()); In code above createButtonListener() returns ActionListener. My question

Android circular button clickable area

随声附和 提交于 2021-01-21 09:26:33
问题 I've made this circular button in Android Studio: I used a custom backgroud. The problem is that the highlighted yellow area in the image, is clickable. I want to reduce the clickable area to just the red circle. Is there any way to do such thing? 回答1: You cannot remove that transparent area of your image. Because it's a part of your image. Any kind of image always have rectangular shape . If the corners of the image are transparent, doesn't mean those pixels at the corner are separated from

How can I change the color of my text based on the color of the ImageView it overlays?

偶尔善良 提交于 2021-01-21 05:04:51
问题 So I've got transparant buttons with white text labels set up over a user uploaded ImageView . If the user uploads an image that is mostly white, then the buttons are hard to see if not completely invisible. Does anyone know of a way to get the average color of a ImageView 's source picture/drawable? If I can do this, I can compare it to a certain threshold I can trial and error for... If I can get this, then I can change the color of the text on my buttons to the inverted version of this