illegalstateexception

java.lang.IllegalStateException when updating JComboBox with setModel()?

依然范特西╮ 提交于 2019-12-02 12:01:04
I was trying to updating JComboBox with setModel(). However, it throws a java.lang.IllegalStateException. Specifically, I used a JTextField to point to the Editable component of the JComboBox, and Update the JComboBox every time the JTextField recieves a new input. Can anyone tell me the reason? package ui; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import javax.swing.DefaultComboBoxModel; import javax.swing.JComboBox; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JTextField; import javax.swing.JToolBar; import javax.swing.event

Mocked HttpClient calls actual method

情到浓时终转凉″ 提交于 2019-12-02 09:12:30
In my test class I am mocking HTTPclient but when I run test class it calls actual method instead of mock at line final HttpResponse response = httpClient.execute(postRequest); and gives me java.lang.IllegalStateException. Here is my code final HttpClient httpClient = new DefaultHttpClient(); final HttpPost postRequest = new HttpPost(someURL); final String inputJson = mapper.writeValueAsString(someObj); final StringEntity input = new StringEntity(inputJson); input.setContentType("application/json"); postRequest.setEntity(input); final HttpResponse response = httpClient.execute(postRequest); if

Java spring mvc: IllegalStateException: Cannot convert value of type [java.lang.String] to required type

半城伤御伤魂 提交于 2019-12-02 07:57:00
问题 As the title says i'm having an annoying IllegalStateException in my spring web app. I've been through numerous topics here on SO and other forums, without any luck. The error occurs when i'm trying to persist a Note (containing a Folder) in my DB. Here's my controller; @InitBinder public void initBinder(WebDataBinder binder){ binder.registerCustomEditor(Folder.class, new FolderEditor()); } @RequestMapping(value="/notes") public @ResponseBody List<Note> postNote(@RequestParam("folder") String

Java spring mvc: IllegalStateException: Cannot convert value of type [java.lang.String] to required type

不想你离开。 提交于 2019-12-02 07:18:50
As the title says i'm having an annoying IllegalStateException in my spring web app. I've been through numerous topics here on SO and other forums, without any luck. The error occurs when i'm trying to persist a Note (containing a Folder) in my DB. Here's my controller; @InitBinder public void initBinder(WebDataBinder binder){ binder.registerCustomEditor(Folder.class, new FolderEditor()); } @RequestMapping(value="/notes") public @ResponseBody List<Note> postNote(@RequestParam("folder") String folderName, @ModelAttribute(value="note")Note note, BindingResult result){ folderName = folderName

FragmentTransaction is not allowed to be added to back stack?

喜你入骨 提交于 2019-12-02 05:24:48
问题 why cant my fragments be added to back stack? @Override public void onTabSelected(Tab tab, android.app.FragmentTransaction ft) { FragmentTransaction transaction = null; ListFragment newListFragment = new bListFragment(); Fragment newFragment = new EntryFrag(); transaction = getFragmentManager().beginTransaction(); ft.replace(R.id.frameOne, newListFragment); ft.replace(R.id.frameTwo, newFragment); ft.addToBackStack(null); transaction.commit(); } logcat error 11-22 12:30:41.370: E

nullPointerException in multi column list

故事扮演 提交于 2019-12-01 21:14:17
I already tried references from similar question on SO, but hasn't got the appropriate solution. I'm trying to fetch the data from a webpage and display it in format consisting of rows having 4 columns. Data present on webpage: SBIN ;1916.00;1886.85;1.54@LT ;1315.50;1310.30;0.40@TCS ;1180.00;1178.00;0.17@AXISBANK ;1031.30;1005.95;2.52@MARUTI ;1000.35;992.35;0.81@PNB ;931.90;916.35;1.70@GAIL ;400.00;398.45;0.39@ I want to diaplay it in the form SBIN.........1916.00.....1886.85.....1.54 LT...........1315.50.....1310.30.....0.40 and so on. Note that I don't want dots, I want each value to be a

jcombobox as cell editor java.awt.IllegalComponentStateException: component must be showing on the screen to determine its location

霸气de小男生 提交于 2019-12-01 20:55:47
问题 I am using a custom JComboBox as a cell editor in a JTable. When the users gets to the cell using keyboard controls it tries to open the popup. This causes the following error: java.awt.IllegalComponentStateException: component must be showing on the screen to determine its location at java.awt.Component.getLocationOnScreen_NoTreeLock(Component.java:1964) at java.awt.Component.getLocationOnScreen(Component.java:1938) at javax.swing.JPopupMenu.show(JPopupMenu.java:887) at javax.swing.plaf

jcombobox as cell editor java.awt.IllegalComponentStateException: component must be showing on the screen to determine its location

女生的网名这么多〃 提交于 2019-12-01 20:50:38
I am using a custom JComboBox as a cell editor in a JTable. When the users gets to the cell using keyboard controls it tries to open the popup. This causes the following error: java.awt.IllegalComponentStateException: component must be showing on the screen to determine its location at java.awt.Component.getLocationOnScreen_NoTreeLock(Component.java:1964) at java.awt.Component.getLocationOnScreen(Component.java:1938) at javax.swing.JPopupMenu.show(JPopupMenu.java:887) at javax.swing.plaf.basic.BasicComboPopup.show(BasicComboPopup.java:191) at javax.swing.plaf.basic.BasicComboBoxUI

java.lang.IllegalStateException: Cannot initialize context because there is already a root application context present

◇◆丶佛笑我妖孽 提交于 2019-12-01 19:01:31
When running my webapp, I get the stacktrace listed below every other try. Note that there doesn't seem to be multiple ContextLoader definitions im web.xml as far as I can tell. Moreover, the app runs just fine the second/fourth/etc. time. This behaviour is much harder to debug than if it simply didn't work. Can anyone shed some light on this? java.lang.IllegalStateException: Cannot initialize context because there is already a root application context present - check whether you have multiple ContextLoader* definitions in your web.xml! at org.springframework.web.context.ContextLoader

IllegalStateException when MediaCodec.configure Android

强颜欢笑 提交于 2019-12-01 16:27:10
I try create encoder for "audio/3gpp" and my app crash... I use this code String mMime = "audio/3gpp"; MediaCodec mMediaCodec = MediaCodec.createEncoderByType(mMime); MediaFormat mMediaFormat = MediaFormat.createAudioFormat(mMime, RECORDER_SAMPLERATE, 1); mMediaCodec.configure(mMediaFormat, null, null, MediaCodec.CONFIGURE_FLAG_ENCODE); mMediaCodec.start(); Exception java.lang.IllegalStateException android.media.MediaCodec.native_configure(Native Method) at android.media.MediaCodec.configure(MediaCodec.java:256) at com.agent.mobile.TestAppActivity.initMediaCodec(TestAppActivity.java:234)