selected

JTable : how to get selected cells?

人走茶凉 提交于 2019-11-29 09:56:36
I have a JTable and its TableModel, it works well but what I want to do now is to get the selected cells of it. I thought of doing something like : int rows = this.getTable().getRowCount(); int columns = this.getTable().getColumnCount(); for(int i = 0 ; i < rows ; i++) { for(int j = 0 ; j < columns ; j++) { if(table.getCell(i,j).isSelected() //... } } But of course something like this doesn't exist. What should I do instead? BackSlash In JTable, you have the JTable.getSelectedRow() and JTable.getSelectedColumn() You can try combine this two method with a MouseListener and a KeyListener. With

Binding the IsSelected property of ListBoxItem to a property on the object from it's source

落爺英雄遲暮 提交于 2019-11-29 05:32:32
I have a WPF ListBox control and I'm setting its ItemsSource to a collection of item objects. How can I bind the IsSelected property of the ListBoxItem to a Selected property of a corresponding item object without having an instance of the object to set as a Binding.Source ? Just override ItemContainerStyle: <ListBox ItemsSource="..."> <ListBox.ItemContainerStyle> <Style TargetType="{x:Type ListBoxItem}"> <Setter Property="IsSelected" Value="{Binding Selected}"/> </Style> </ListBox.ItemContainerStyle> </ListBox> Oh, by the way, I think you'd like this wonderful articles from dr.WPF:

Google Maps Api 3 Remove Selected Marker Only

ぃ、小莉子 提交于 2019-11-28 16:34:22
I've 2 function as below: function addMarker() { marker = new google.maps.Marker({ position: Gpoint, map: map, draggable: true, animation: google.maps.Animation.DROP }); map.panTo(Gpoint); google.maps.event.addListener(marker, "rightclick", function (point) { showContextMarker(point.latLng); } ); $('.contextmenu').remove(); }; function delMarker() { marker.setMap(null); $('.contextmenu').remove(); }; So, as may understand I have a Context Menu having "Delete Marker" option on it. I am binding a "rightclick" listener during adding a marker, to show this menu. Everything is working without any

How do I make the DataGridView show the selected row?

一笑奈何 提交于 2019-11-28 16:23:54
问题 I need to force the DataGridView to show the selected row . In short, I have a textbox that changes the DGV selection based on what is typed into the textbox . When this happens, the selection changes to the matching row . Unfortunately if the selected row is out of the view, I have to manually scroll down to find the selection. Does anyone know how to force the DGV to show the selected row ? Thanks! 回答1: You can set: dataGridView1.FirstDisplayedScrollingRowIndex = dataGridView1.SelectedRows

retaining selected dropdown option on postback

孤街醉人 提交于 2019-11-28 14:30:30
How do I retain whatever was selected from the dropdown even after page refresh so user knows what he/she selected using jquery? or javascript? <select id="hospitalDropDown" onchange="window.open(this.options[this.selectedIndex].value,'_top')"> <option disabled="disabled">Select Hospital</option> <option value="http://mysite.com/events/Pages/default1.aspx">All Hospitals</option> <option value="http://mysite.com/events/Pages/default1.aspx?hos=Dyer">Dyer</option> <option value="http://mysite.com/events/Pages/default1.aspx?hos=Carmel">Carmel</option> </select> Try this: <select id=

How to remove the selected element during a clone() operation

℡╲_俬逩灬. 提交于 2019-11-28 14:19:05
I have a select box that gets cloned. I want to remove the user's previous selection from each cloned select box. Here is the method that does the clone() : function addselect(s){ $('#product_categories > .category_block:last').after( $('#product_categories > .category_block:last').clone() ); set_add_delete_links(); return false; } function set_add_delete_links(){ $('.remove_cat').show(); $('.add_cat').hide(); $('.add_cat:last').show(); $("#product_categories > .category_block:only-child > .remove_cat").hide(); } function removeselect(s){ $(s).parent().remove(); set_add_delete_links(); return

How to Get Selected Text and Value Android ListPreference

若如初见. 提交于 2019-11-28 09:45:33
The XML file of my ListPreference <ListPreference android:key="lpBirim" android:title="Birim" android:summary="" android:defaultValue="0" android:persistent="false"/> How to get the selected text and the selected value? in your PreferenceActivity do something like: ListPreference listPreference = (ListPreference) findPreference("lpBirim"); CharSequence currText = listPreference.getEntry(); String currValue = listPreference.getValue(); Sunil Kumar Sahoo You can use this snippet to get the value: SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this); sp.getString("lpBirim","

change color of selected menu tab

时光怂恿深爱的人放手 提交于 2019-11-28 09:37:41
问题 I grabbed this snippet from another question: <script type='text/javascript' > $(document).ready(function () { $("div.content ul li a") .mouseover(function () { var t = $(this); if (!t.hasClass("clicked")) { // very easy to check if element has a set of styles t.addClass('mouseover'); } }) .mouseout(function () { // attach event here instead of inside mouse over $(this).removeClass('mouseover'); }); $("div.content ul li a").click(function () { var t = $(this); t.toggleClass("clicked"); if (t

thymeleaf multiple selected on edit

孤人 提交于 2019-11-28 08:25:20
I am totally changing this question, as part of it was answered here with great help of Avnish! Tom sent me to the right direction so thank you Tom! My problem is that I do not know how to tell Thymeleaf to preselect object elements when editing it. Let me show you: This solution works: <select class="form-control" id="parts" name="parts" multiple="multiple"> <option th:each="part : ${partsAtribute}" th:selected="${servisAttribute.parts.contains(part)}" th:value="${part.id}" th:text="${part.name}">Part name</option> </select> I have tried this: <select class="form-control" th:field="*{parts}"

UITableViewCell Selected Background Color on Multiple Selection

亡梦爱人 提交于 2019-11-28 05:16:29
// Doesn't work cell.selectionStyle = .Blue //Works when the selection is not multiple, if it's multiple with each selection the previous one disappear... let cellBGView = UIView() cellBGView.backgroundColor = UIColor(red: 0, green: 0, blue: 200, alpha: 0.4) cell.selectedBackgroundView = cellBGView Any answer how to set background color of the cells which are selected? Somoy Das Gupta Swift 4.2 For multiple selections you need to set the UITableView property allowsMultipleSelection to true . myTableView.allowsMultipleSelection = true In case you subclassed the UITableViewCell , you override