|
Okay, I have a question similar to the MultiMap one last page. I have a grid of devices laid out, with each device taking up (possibly) several grid cells, and in addition devices can be layered so that there are several on a single cell. I want to be able to go from a cell to the devices on said cell, and from a device to all cells covered by that device. Is there anything better than just using two HashMaps/MultiMaps for this, one for each direction?
|
# ¿ Apr 29, 2008 17:45 |
|
|
# ¿ May 9, 2024 11:53 |
|
shodanjr_gr posted:Im coming back to this. I read the link on Sun's dev pages about SWING and threads. I don't understand what you mean by "spin my MouseInputListener into a separate thread". Listeners of all sorts run pretty much exclusively on the EDT, are you doing some trickery to then do the actual work in a separate thread or something? When you attach a MouseListener or other listener to a java swing component, all the work done by that listener is called from the EDT, no matter what thread the listener was created on, attached on, whatever. The only way I can think of to spin the work onto a separate thread would be to use some type of inter-thread communication when your listener registers an event, which would be kinda awkward, but feasible. Without seeing any of your code, I can't tell if that is what you are doing or not. If not, then you may still be running the listener events on the EDT. If you are doing a lot of painting as well, that could clog the EDT so that mouse events bunch up. I've run into this problem a few times, doing custom painting but refreshing it too quickly. I guess the take-away message is that all GUI work occurs on the EDT, so if you're experiencing slowdown then some part of your GUI displaying/updating is taking too long, or being called too often. I'm sorry I can't really give you more direction than that, I hope it's helpful.
|
# ¿ May 27, 2008 18:32 |
|
So I have a library question for anyone up to the challenge. I'm looking to deserialize a stream of JSON objects coming in over a network connection. I'd like to find a JSON library capable of deserializing these objects, but in a non-blocking fashion: i.e. I feed the library bits of data, and it gives me back complete objects when they're done. The API I kinda imagine would be similar to this: code:
At this point I'm pretty much resigned to just making something myself, but if there is something that can do this that'd be awesome.
|
# ¿ Jun 8, 2011 04:53 |
|
Jabor posted:Is there a reason you need to do this drip-feeding instead of, say, My end goal is to have a single server, many client setup, where creating a thread on the server for each client just wouldn't scale. I'm basically building baby's first networked game, figured I'd use JSON as a transport mechanism because it's fairly easy to understand and I don't care much about the overhead (not much being transmitted anyway).
|
# ¿ Jun 8, 2011 06:40 |
|
Hidden Under a Hat posted:I feel like this should be something simple but I haven't been able to find a solution after quite a bit of googling... is there a way to add a subscript or superscript to a string and have it be treated as a string so it can be printed in TextFields, etc. I word it like that because I know about AttributedString, but it doesn't seem like that can be used interchangeably with regular text strings. Unicode has a few pre-defined superscripts and subscripts, but not support for arbitrary strings in super/subscripts. See wikipedia for details. That said, some form of markup (or AttributedString) may be preferable. I've never done rich text display, so I'm not sure what the go-to solution is, or even what Swing elements display formatted text.
|
# ¿ Jun 24, 2011 21:37 |