JScrollBar, remove keyListener? - swing

Hey you all, just a quick question of what i havent found anywhere. Im adding a scrollpane to a JPanel, with 2 JScrollBars. One vertical and one horizontal. Everything works fine just that i dont want the ScrollBars to scroll using the arrow keys. How do i achieve this?
I´ve been checking out adjustmentlisteners but really havent found anything of high value to me. Thanks for any help!

you have to tweak the keybinding in the scrollPane's inputMap and point the navigation keys into nirwana, like:
InputMap inputMap = scrollPane.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
inputMap.put(KeyStroke.getKeyStroke("RIGHT"), "do-nothing");
// same for all navigation keys you want to disable
...
to find which keyStrokes are registered, look into the BasicLookFeel - the section in getDefaults which relates to "ScrollPane"
Beware: that's highly unusual, you user's might be annoyed!

Related

dropdown div hidden when inside table tr

I'm not sure if there is another post similar to this one but I'm hoping this can be a simple fix for someone better as css than me.
See the example here: https://svelte.dev/repl/e7d663de324043f98613b8fe35b8d78f?version=3.47.0
I build the example in Svelte repl but the issue is with the html and css.
The problem is that the dropdown part of the SimpleSelector is hidden behind the other rows below it.
I've tried to set the z-order but that doesn't seem to work. I tried playing with the display attribute and position but I can't seem to get this to work the way I want.
Try clicking on the textbox on any row. You'll see part of the dropdown but the rest is hidden.
Thanks in advance for any help.
I figured it out.
It seems that the z-index had to be set separately for each row.
For example, if there are 100 rows, the first row should have z-index: 100, the second row, z-index: 99, the third, z-index: 98 and so on.
That seemed to have done the trick.
Here is a link to the updated REPL: https://svelte.dev/repl/e84a80ef53a64af6975705407ddff040?version=3.48.0
However, in the end, I redesigned how the interface will work and I will not be editing inline in the table anymore so I won't be using this solution.

Make resizable methods makes input fields not clickable

I've really strange behavior and I spent a couple of days to try to figure out what is a problem.
MooTools methods makes my input fields not clickable, and I don't know why.
$$('.class1.class2').makeResizable({
});
Above piece of code needs to make all children of div which has class 'class1' & 'class2' to be re-sizable, and that works perfectly but beside that it also makes input fields not clickable.
Does anybody had the similar problem?
Any kind of help will be appreciate.
Thanks
so the problem is that you have no handle passed in. when you fail to do that, the whole element becomes a listener for mousedown and attempts to click into any child element will not bubble correctly, resulting in weird behaviour.
I also found a bug in the logic for adding handlers, which seems to not evaluate handles correctly
https://github.com/mootools/mootools-more/blob/master/Source/Drag/Drag.js#L66 is wrong on many levels - it expects a collection / array of elements but looks in the global document and not child elements - yet it ends up picking element anyway and ignores passed collections like $$('.class1 .resizer')
i did a small change to accept a string for a child selector and added a resize handler.
http://jsfiddle.net/pbu5uzho/
you should submit this bug to https://github.com/mootools/mootools-more/issues though i doubt it will get picked up.
$$('.class1').makeResizable({
handle: '.resizer'
});
the change I did to make this work was:
this.handles = this.element.getElements(this.options.handle);
alternatively, you can use something like InteractJS to handle this.
I'm not 100% sure but can you try this one
I think you are missing (,)
$$('.class1,.class2').makeResizable({
});

How to make list scrolling only with mouse (actionscript 3)

You can see this list here http://www.studia-kuhni.ru/exec.swf.
List.change
List.itemRollOut
List.itemRollOver
List.scroll
What I should use? How I can scroll list as like as on that swf? (i know about tweenmax, question about scrolling)
May be somebody know beautiful and well made examples?
Thank you.
Try using List.scroll listener, and update 'selectedIndex' with respect to the scroll direction. For eg., my_list.selectedIndex += 1 to select the next item.

What is this called, and how do i replicated it in CSS?

I know the title stinks, but as it says i have no idea what the name is for what i want to create.
I want to do a list of links (or rather a menu if you prefer, but with no drop down), that looks like this:
This is just an example so it isnt very pretty. Its having those arrows in each box, and have them "connected" to eachother, but each box is an individual element. I think this type of style has a name, what is it called? Will help greatly searching for help.
I wish to achieve this by making the elements purely by CSS, and the closest i have come is help from this page: http://www.css3shapes.com/ but i just cant combine them to create the menu.
Any and all kinds of help is appreciated.
It's called BreadCrumbs.
It's easier to "paint" it than you think.
Here's a tip:
This is a single arrow:
And the magic:
We used to call it breadcrumbs with arrowboxes. But its up to you. I dont think there is a generic name.
Check out these links
- http://www.red-team-design.com/css3-breadcrumbs
- http://thecodeplayer.com/walkthrough/css3-breadcrumb-navigation

Java swing CheckBox is not visible in JCheckBoxMenuItem

The checkbox icon is not visible in my JCheckBoxMenuItem..I add this JCheckBoxMenuItem to JideMenu which extends JMenu.How to make this checkbox visible eventhough if it is not selected..?
Thanks in advance.
I'm not entirely certain where your problem is coming from. It sounds that just the checkbox component isn't visible, while all other MenuItem types are showing up on the Menu.
I'm not very experienced with the Swing library, but if you could put a few lines of code regarding your Menu/MenuItems, I'm certain you'll get a much better answer.
Taking a shot in the dark, you mention that the MenuItem (checkbox) is added to the menu, but have you added the menu into a MenuBar/JMenuBar object and set your JFrame to use that Bar via the setMenuBar() method? This is under the assumption that the entire menu isn't showing up (not just the checkbox component), but figured I'm try to preempt a solution here.
menuBar = new JMenuBar();
menu = new JMenu("A Menu");
menuBar.add(menu);
cbMenuItem = new JCheckBoxMenuItem("A check box menu item");
menu.add(cbMenuItem);
It´s pretty much straightforward and taken directly from here. I guess it´s all anyone can say about it until you show us your code.
setState(true) will show the checkmark… IIRC there's also a constructor that you can pass a boolean if you want it created with the checkmark visible.