button

Opening a new JFrame from a Button

蹲街弑〆低调 提交于 2020-01-09 12:10:52
问题 I want to open a new JFrame by clicking a button (btnAdd); I have tried to create an actionlistener but I am having no luck; the code runs but nothing happens when the button is clicked. The methods in question are the last two in the following code. Any help is much appreciated! package AdvancedWeatherApp; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; import java.awt.Container; import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.Font;

Opening a new JFrame from a Button

旧城冷巷雨未停 提交于 2020-01-09 12:08:07
问题 I want to open a new JFrame by clicking a button (btnAdd); I have tried to create an actionlistener but I am having no luck; the code runs but nothing happens when the button is clicked. The methods in question are the last two in the following code. Any help is much appreciated! package AdvancedWeatherApp; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; import java.awt.Container; import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.Font;

Opening a new JFrame from a Button

青春壹個敷衍的年華 提交于 2020-01-09 12:05:38
问题 I want to open a new JFrame by clicking a button (btnAdd); I have tried to create an actionlistener but I am having no luck; the code runs but nothing happens when the button is clicked. The methods in question are the last two in the following code. Any help is much appreciated! package AdvancedWeatherApp; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; import java.awt.Container; import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.Font;

android start user defined activity on search button pressed @ handset

▼魔方 西西 提交于 2020-01-09 09:58:14
问题 I am using following code to start activity when user pressing search button on the handset @Override public boolean onKeyUp(int keyCode, KeyEvent event) { if(keyCode == KeyEvent.KEYCODE_SEARCH){ Util.startActivity(ReviewsDetail.this, KeywordSearch.class); return false; }else{ return super.onKeyUp(keyCode, event); } } But here are few issues with it please look at the following image. When press search button it first show google search box at the top of activity then start activity which i

Floating Action Button

余生颓废 提交于 2020-01-09 05:39:31
问题 I have been trying to use Floating Action Button. I tried to use some of the resources suggested on here and the links were great; however, I couldn't use alot of them because of problems with dependicies. I tried to fix it but it got more messed up. Long story short, I use the following code as a way to bypass dependicies in my bundle. I got the button to work; however, I couldn't figure out how to have options to appear when the button is clicked. I tried on clicklistener and other ways but

GradientDrawable with OVAL shape not working inside programatically added Text View

房东的猫 提交于 2020-01-07 09:44:31
问题 I have programmatically added Text View and Button . Code final TextView test = new TextView(getApplicationContext()); test.setText(String.valueOf(counterQuantity)); test.setTextColor(getResources().getColor(R.color.black)); test.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 10); GradientDrawable border = new GradientDrawable(); border.setShape(GradientDrawable.OVAL); border.setStroke(1, getResources().getColor(R.color.black)); border.setCornerRadius(2); border.setColor(getResources().getColor(R

GradientDrawable with OVAL shape not working inside programatically added Text View

别说谁变了你拦得住时间么 提交于 2020-01-07 09:43:05
问题 I have programmatically added Text View and Button . Code final TextView test = new TextView(getApplicationContext()); test.setText(String.valueOf(counterQuantity)); test.setTextColor(getResources().getColor(R.color.black)); test.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 10); GradientDrawable border = new GradientDrawable(); border.setShape(GradientDrawable.OVAL); border.setStroke(1, getResources().getColor(R.color.black)); border.setCornerRadius(2); border.setColor(getResources().getColor(R

Is it possible to save the state of a button in one activity and then pass it on to a new activity?

两盒软妹~` 提交于 2020-01-07 08:23:09
问题 My question pretty much sums up what I want to do. My idea is if lets say (button 1 from activity A is pressed) and activity B is loaded I want to pass in activity B the state of button 1 (pressed or not) and I want to do something with it. For example: if(button1.isChecked()) { //do something } 回答1: In the first activity, you can use: Intent intent = new Intent(this, Your 2nd Activity.class); intent.putExtra("buttonStatus", "you button status true or false"); startActivity(intent); and in

Is it possible to save the state of a button in one activity and then pass it on to a new activity?

流过昼夜 提交于 2020-01-07 08:22:13
问题 My question pretty much sums up what I want to do. My idea is if lets say (button 1 from activity A is pressed) and activity B is loaded I want to pass in activity B the state of button 1 (pressed or not) and I want to do something with it. For example: if(button1.isChecked()) { //do something } 回答1: In the first activity, you can use: Intent intent = new Intent(this, Your 2nd Activity.class); intent.putExtra("buttonStatus", "you button status true or false"); startActivity(intent); and in

OnItemClickLisener does not work

梦想的初衷 提交于 2020-01-07 07:38:08
问题 i am trying to make list view with clickable items, and every list_item must consist 2 clickable buttons. But if i add buttons to item layout, iten click listener stops to work... here is my item_layout: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margin="5dp" android:gravity="center">