add

Add Object to JPanel after button click

放肆的年华 提交于 2019-12-02 04:17:00
I have created a JScrollPane with a JPanel inside it and I want to add JPanel/JLabel/Other objects after pressing the button. For example after three button presses I want to get something like this: I tried myJPane.add(testLabel) with testlabel.setBounds() but no result, I don't want to use GridLayout because of the unchangeable sizes. I would like it if the added objects had different sizes - adjusted to the text content. What should I use for it and how? Thanks in advance. Best regards, Tom. Here is a JPanel inside a JScrollPane that adds JLabel s to it when pressing the button: public

add boundField to gridview in codebehind file C#

跟風遠走 提交于 2019-12-02 02:47:55
问题 I want to create new gridview in codebehind file asp.net C#. Exactly I want to add such boundfield to the gridview by c# code: <asp:BoundField DataField="p_type" HeaderText="type" ItemStyle-Width="70px"> <ItemStyle Width="70px"></ItemStyle> </asp:BoundField> I crated new gridview with following code: GridView GridView1 = new GridView(); GridView1.AllowPaging = false; GridView1.CellPadding = 4; GridView1.GridLines= GridLines.None; GridView1.AutoGenerateColumns = false; And I want to add new

Swift NSMutableArray add one more array

吃可爱长大的小学妹 提交于 2019-12-02 01:02:52
The Problem is First time I get data from WebServices so I have show this data on TableView Then user scroller down tableview then again call WebSevices and add this data to again in array but when I try to add data again in nsmutable type array app is crashing Here is my code. Any solution? 1st time Data load is Working var ary_mutable: NSMutableArray! ary_mutable = NSMutableArray() ary_mutable=jsonResult as AnyObject as! NSMutableArray self.tbl_T.reloadData(); self.tbl_T.delegate=self; self.tbl_T.dataSource=self; 2nd Time data load and add with old array not Working var myArray :NSArray!

add boundField to gridview in codebehind file C#

寵の児 提交于 2019-12-01 23:27:09
I want to create new gridview in codebehind file asp.net C#. Exactly I want to add such boundfield to the gridview by c# code: <asp:BoundField DataField="p_type" HeaderText="type" ItemStyle-Width="70px"> <ItemStyle Width="70px"></ItemStyle> </asp:BoundField> I crated new gridview with following code: GridView GridView1 = new GridView(); GridView1.AllowPaging = false; GridView1.CellPadding = 4; GridView1.GridLines= GridLines.None; GridView1.AutoGenerateColumns = false; And I want to add new boundField to this gridview. How to make that with c# code? this article explain you how implement in c#

How can i test an Add function on CakePHP2.0

泪湿孤枕 提交于 2019-12-01 22:41:09
I have been told that we have to test also the functions created by Cake like add/delete... If i have a function like this one, how can i test it if it doesn't have any return, redirect or even a view? ( i use ajax to execute it) public function add() { if ($this->request->is('post')) { $this->Comment->create(); if ($this->Comment->save($this->request->data)) { $this->Session->setFlash(__('The comment has been saved')); } else { $this->Session->setFlash(__('The comment could not be saved. Please, try again.')); } } } Thanks public function add() { $this->autoRender = false; if ($this->request-

How do I add time to a timestamp?

£可爱£侵袭症+ 提交于 2019-12-01 19:38:39
I need to add 14 minutes and 59 seconds to an unknown time in an array. How do I do this? This is what I have so far: Date duration = df.parse("0000-00-00 00:14:59"); arrayOpportunity[2] = arrayOpportunity[2] + duration; The time is not being changed. Thanks! I have done my research. I cant paste the entire code I have. But mainly I didnt want to make you read it all. Just looking for a simple answer of how to add two timestamps. If you are talking about a java.sql.Timestamp , it has a method called setTime . java.util.Date has a setTime method as well for that sort of thing. You could

Add a constant value to all rows in a dataframe

ぃ、小莉子 提交于 2019-12-01 18:44:13
I want to add the number 1 to all the rows and columns of dataframe. Here's the dataframe: df <- structure(list(units = c(422, 188, 314, 197, 2825, 3210, 450, 117, 291, 161, 113, 259), quantity = c(361, 163, 298, 74, 1997, 2803, 164, 62, 203, 140, 115, 269), KP = c(282, 194, 295, 102, 1772, 1610, 151, 295, 126, 157, 191, 233), level = c(215, 62, 215, 78, 1646, 635, 128, 65, 126, 402, 552, 281)), .Names = c("units", "quantity", "KP", "level"), row.names = c(NA, 12L), class = "data.frame") which looks like: units quantity KP level 1 422 361 282 215 2 188 163 194 62 3 314 298 295 215 4 197 74 102

Python merging dictionary of dictionaries into one dictionary by summing the value

醉酒当歌 提交于 2019-12-01 18:35:30
I want to merge all the dictionaries in a dictionary, while ignoring the main dictionary keys, and summing the value of the other dictionaries by value. Input: {'first':{'a': 5}, 'second':{'a': 10}, 'third':{'b': 5, 'c': 1}} Output: {'a': 15, 'b': 5, 'c': 1} I did: def merge_dicts(large_dictionary): result = {} for name, dictionary in large_dictionary.items(): for key, value in dictionary.items(): if key not in result: result[key] = value else: result[key] += value return result Which works, but I don't think it's such a good way (or less "pythonic"). By the way, I don't like the title I wrote

Sum of the digits of an integer in lua

有些话、适合烂在心里 提交于 2019-12-01 17:48:06
问题 I saw a question like this relating to Java and C, but I am using LUA. The answers might have applied to me, but I wasn't understanding them. Could someone please tell me how I would get the sum of the individual digits of an Integer. For Example. a = 275 aSum = 2+7+5 If you could explain how I would achieve this in LUA and why the code does what it does, that would be greatly appreciated. 回答1: Really a simple function. Using gmatch will get you where you need to go. function sumdigits(str)

Add days to current date from MySQL with PHP

本秂侑毒 提交于 2019-12-01 17:21:01
I have a fixed date from MySql startDate = 07/03/2011 I wanted to add 60 days on top this date to have an endDate. $startDate = $result['startDate']; $endDate = ??? + strtotime("+60 days"); echo $endDate; From my research, I know it has something do with strtotime, but all the sites I come across with based the start date from current workstation's time. My date is already fixed and entered prior to running and getting the endDate. Help? Thanks in advance! In addition to PHP solutions others are providing, you can create the endDate right inside of MySQL and save yourself some of the trouble: